Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8220238

Enhancing j.l.Runtime/System::gc specification with an explicit 'no guarantee' statement

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 13
    • 13
    • core-libs
    • b24

        Current specifications for the following methods:

        https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/System.html#gc()
        https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Runtime.html#gc()

        might give a false impression that garbage collection is guaranteed to happen eventually.

        However garbage collection may never ever happen. It would be beneficial to add an explicit mention of this fact as some kind of a disclaimer, like the following:

        - "Please note that implementation of this method does not guarantee that garbage collection will be ever started"

        or

        - "Implementation of this method is allowed to not implement or trigger any memory reclamation mechanism"

              rriggs Roger Riggs
              dbessono Dmitry Bessonov
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: