Why is java8 GC not going for more than 11 hours?

Context : 64-bit Oracle Java SE 1.8.0_20-b26

For more than 11 hours, objects in the Tenured generation have accumulated in my running java8 application (about 25%). So, I manually clicked the Perform GC button in jconsole, and you can see a sharp drop in the heap memory to the right of the diagram. I have no special VM parameters other than XX:NewRatio=2 .

Why does the GC not clear the generation?

jconsole heap trend

+1
source share
3 answers

This is the expected and desired behavior. The JVM successfully avoids the Major GC by running the timely Minor GC all the time. A small GC, by definition, does not affect Tenured Generation, and the key idea of ​​garbage collectors for generation is that this pattern will appear.

You should be very happy with the way your application sings.

+3
source

Why does the GC not clear the generation?

Because it is not necessary.

It looks like your application accumulates spent garbage at a relatively slow speed, and there is still a lot of room for objects in storage. The bandwidth collector usually only works when space is full. This is most efficient in terms of CPU utilization ... which optimizes collector throughput.

In short, the GC is working as intended.

If you are concerned about the amount of memory used (because the occupied space is not collected), you can try to run the application with a smaller heap. However, the graph shows that the initial behavior of the application can differ significantly from its stationary behavior. In other words, it might take a lot of your application to get started. If so, then reducing the size of the heap can stop the application from working, or at least make the startup phase much slower.

+2
source

The primary goal of the bandwidth collector is, she said, bandwidth (via GCTimeRatio ). Its secondary goal is pause time ( MaxGCPauseMillis ). Only as a tertiary goal , he believes that the level of memory is low.

If you want to achieve a small heap size, you will have to relax the other two goals.

You can also reduce MaxHeapFreeRatio so that the JVM can return memory back to the OS.

+2
source

Source: https://habr.com/ru/post/1215341/


All Articles