< prev index next >

test/jdk/java/rmi/server/UnicastRemoteObject/unexportObject/UnexportLeak.java

Print this page
rev 57595 : v2.09a with 8235795, 8235931 and 8236035 extracted; rebased to jdk-14+28; merge with 8236035.patch.cr1; merge with 8235795.patch.cr1; merge with 8236035.patch.cr2; merge with 8235795.patch.cr2; merge with 8235795.patch.cr3.

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -72,19 +72,22 @@
             throw new RuntimeException("FAILED: RemoteException encountered");
         }
     }
 
     /**
-     * Force desparate garbage collection so that all WeakReference instances
+     * Force desperate garbage collection so that all WeakReference instances
      * will be cleared.
      */
     private static void flushRefs() {
         java.util.Vector chain = new java.util.Vector();
         try {
             while (true) {
                 int[] hungry = new int[65536];
                 chain.addElement(hungry);
             }
         } catch (OutOfMemoryError e) {
+            // An inflated Java monitor can keep 'obj' alive so request
+            // an explicit GC to make sure things are cleaned up.
+            System.gc();
         }
     }
 }
< prev index next >