test/jdk/java/util/logging/TestLoggerWeakRefLeak.java
changeset 54065 f984aca565c1
parent 53858 e7cf035682e3
equal deleted inserted replaced
54064:d3888a37ad03 54065:f984aca565c1
   121             java.util.logging.Logger.getAnonymousLogger();
   121             java.util.logging.Logger.getAnonymousLogger();
   122         }
   122         }
   123     }
   123     }
   124 
   124 
   125     /**
   125     /**
   126      * 'vm.heapHisto("", "-live")' will request a full GC
   126      * 'vm.heapHisto("-live")' will request a full GC
   127      */
   127      */
   128     private static int getInstanceCountFromHeapHisto() throws AttachNotSupportedException, Exception {
   128     private static int getInstanceCountFromHeapHisto() throws AttachNotSupportedException, Exception {
   129         int instanceCount = 0;
   129         int instanceCount = 0;
   130 
   130 
   131         HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine
   131         HotSpotVirtualMachine vm = (HotSpotVirtualMachine) VirtualMachine
   132                 .attach(Long.toString(ProcessTools.getProcessId()));
   132                 .attach(Long.toString(ProcessTools.getProcessId()));
   133         try {
   133         try {
   134             try (InputStream heapHistoStream = vm.heapHisto("", "-live");
   134             try (InputStream heapHistoStream = vm.heapHisto("-live");
   135                     BufferedReader in = new BufferedReader(new InputStreamReader(heapHistoStream))) {
   135                     BufferedReader in = new BufferedReader(new InputStreamReader(heapHistoStream))) {
   136                 String inputLine;
   136                 String inputLine;
   137                 while ((inputLine = in.readLine()) != null) {
   137                 while ((inputLine = in.readLine()) != null) {
   138                     if (inputLine.contains(TARGET_CLASS)) {
   138                     if (inputLine.contains(TARGET_CLASS)) {
   139                         instanceCount = Integer.parseInt(inputLine
   139                         instanceCount = Integer.parseInt(inputLine