< prev index next >

src/java.base/share/classes/java/lang/System.java

Print this page
rev 55032 : 8220238: Enhancing j.l.Runtime/System::gc specification with an explicit 'no guarantee' statement
Reviewed-by: tbd

@@ -1780,18 +1780,19 @@
     public static void exit(int status) {
         Runtime.getRuntime().exit(status);
     }
 
     /**
-     * Runs the garbage collector.
+     * Runs the garbage collector in the Java Virtual Machine.
      *
-     * Calling the {@code gc} method suggests that the Java Virtual
-     * Machine expend effort toward recycling unused objects in order to
-     * make the memory they currently occupy available for quick reuse.
-     * When control returns from the method call, the Java Virtual
-     * Machine has made a best effort to reclaim space from all discarded
-     * objects.
+     * Calling the {@code gc} method suggests that the Java Virtual Machine
+     * expend effort toward recycling unused objects in order to
+     * make the memory they currently occupy available for reuse
+     * by the Java Virtual Machine.
+     * There is no guarantee that this effort will recycle any particular
+     * number of unused objects, reclaim any particular amount of space,
+     * or complete at any particular time, if at all.
      * <p>
      * The call {@code System.gc()} is effectively equivalent to the
      * call:
      * <blockquote><pre>
      * Runtime.getRuntime().gc()
< prev index next >