Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I got these kind of lines in my gc output:</p> <pre><code>44871.602: [GC-- [PSYoungGen: 342848K-&gt;342848K(345600K)] 961401K-&gt;1041877K(1044672K), 0.1018780 secs] [Times: user=0.16 sys=0.00, real=0.11 secs] </code></pre> <p>I read Yishai's answer and it would make sense, but I wanted to see it for myself in the Java GC source code, when the JVM prints "--" in the GC log and why.</p> <p>Because to my knowledge "Parallel Scavenge" of the Young Gen is a stop-the-world GC, so there <strong>couldn't be any objects created parallel</strong> to this GC. (see <a href="https://blogs.oracle.com/jonthecollector/entry/our_collectors" rel="noreferrer">https://blogs.oracle.com/jonthecollector/entry/our_collectors</a>)</p> <p>You can find this in the jdk source code (see <a href="http://hg.openjdk.java.net/jdk7/jdk7" rel="noreferrer">http://hg.openjdk.java.net/jdk7/jdk7</a>) g1CollectedHeap.cpp and psScavenge.cpp</p> <pre><code>jdk7-ee67ee3bd597/hotspot/src/share$ egrep -h -A2 -B5 -r '"\-\-"' * # G1 Collector if (evacuation_failed()) { remove_self_forwarding_pointers(); if (PrintGCDetails) { gclog_or_tty-&gt;print(" (to-space overflow)"); } else if (PrintGC) { gclog_or_tty-&gt;print("--"); } } -- # Parallel Scavenge Collector promotion_failure_occurred = promotion_failed(); if (promotion_failure_occurred) { clean_up_failed_promotion(); if (PrintGC) { gclog_or_tty-&gt;print("--"); } } </code></pre> <h1>Reason for GC-- with the Parallel Scavenge Collector</h1> <p>The Young GC encountered a promotion failure (see <a href="http://mail.openjdk.java.net/pipermail/hotspot-gc-use/2010-March/000567.html" rel="noreferrer">http://mail.openjdk.java.net/pipermail/hotspot-gc-use/2010-March/000567.html</a>):</p> <blockquote> <blockquote> <p>A promotion failure is a scavenge that does not succeed because there is not enough space in the old gen to do all the needed promotions. The scavenge is in essence unwound and then a full STW compaction of the entire heap is done.</p> </blockquote> </blockquote> <p>'Not enough space' doesn't necessarily mean that there isn't enough space in old, but that the old space is heavily fragmented (see <a href="http://blog.ragozin.info/2011/10/java-cg-hotspots-cms-and-heap.html" rel="noreferrer">http://blog.ragozin.info/2011/10/java-cg-hotspots-cms-and-heap.html</a>):</p> <blockquote> <blockquote> <p>[...] it is impossible to find certain amount of continuous memory to promote particular large object, even though total number of free bytes is large enough. </p> </blockquote> </blockquote> <p>These two JVM options could help you analyze your heap fragmentation (see <a href="http://blog.ragozin.info/2011/10/java-cg-hotspots-cms-and-heap.html" rel="noreferrer">http://blog.ragozin.info/2011/10/java-cg-hotspots-cms-and-heap.html</a>):</p> <pre><code>-XX:+PrintPromotionFailure -XX:PrintFLSStatistics=1 </code></pre> <h1>Reason for GC-- with the G1 Collector</h1> <p>A evacuation failure with the G1 is when a Survivor Region hasn't enough space for the surviving objects from a Young Region.</p> <p>I don't know if the G1 Collector responds to a evacuation failure with a Full GC or not.</p>
 

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