Search code examples
javagarbage-collection

Meaning of the different Java CMS garbage collection logs memory sizes


log entry of the concurrent mark sweep garbage collector contains information like (trimmed and line breaks inserted for readability) on Java-8:

{Heap before GC invocations=3 (full 0):
...
 concurrent mark-sweep generation total 29612480K, used 994856K ...
2021-10-25T02:40:58.947+0200: 27.293: [GC (Allocation Failure) 2021-10-25T02:40:58.947+0200: 27.293:
  [ParNew: 996800K->110720K(996800K), 1.6650446 secs]
          1991656K->1859618K(30609280K), 1.6651368 secs] ...
Heap after GC invocations=4 (full 0):
...
concurrent mark-sweep generation total 29612480K, used 1748898K ...
}

Question: How does the mark-sweep generation ..., used 1748898K relate to the the resulting sizes after the collection given by ->110720K for ParNew and by ->1859618K. From the wording I would have expected that maybe the sum of the two ->-values should be hte used value. What does the used value mean?


Solution

    • 110720K is what survived from the young generation.
    • 1859618K is the occupied space in the entire heap.
    • 1748898K is the space used in the old generation (1859618K - 110720K = 1748898K)