Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>NetBeans, at least, uses System.gc(): <a href="http://hg.netbeans.org/main/annotate/9779f138a9c9/openide.actions/src/org/openide/actions/GarbageCollectAction.java" rel="noreferrer">http://hg.netbeans.org/main/annotate/9779f138a9c9/openide.actions/src/org/openide/actions/GarbageCollectAction.java</a> (this is for the little button that shows current heap and lets you start GC). If you follow that link, you'll see that they explicitly run finalizers. If you have a few gig of disk space free, and want to investigate the code yourself, it's available via Mercurial: <code>hg clone http://hg.netbeans.org/main/</code></p> <p>As far as I can tell, the "System.gc() is just a hint" dogma originates in pedantic interpretation of the JLS and JVM Spec, which allow for Java implementations that don't have a garbage-collected heap. That, and an incomplete reading of the <a href="http://java.sun.com/javase/6/docs/api/java/lang/System.html#gc()" rel="noreferrer">JavaDoc</a>:</p> <blockquote> <p>Calling the 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.</p> </blockquote> <p>Read the second sentence: "best effort to reclaim space" is a lot stronger than "hint."</p> <p>That said, there's rarely a reason to call <code>System.gc()</code>. With apologies to Knuth:</p> <blockquote> <p>We should forget about memory management, say about 97% of the time: explicit garbage collection is the root of all evil</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload