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.
source share