While monitoring a java program with VisualVM, I noticed an interesting pattern in the garbage collector's behaviour. It seems like very often, right after doing a 'normal' garbage collection run, the GC does a second, much more cpu intensive run, which appears to have no additional effect (The used heap after the more aggressive run is about the same as it is after the lighter run).
I've indicated on VisualVM's output where you can see the garbage collector runs and corresponding heap-usage changes.
My question is basically what is the Garbage collector doing here and why? What is causing it to attempt these really cpu-intensive runs when there's plenty of free memory, and no observable benefit versus the lighter runs? Or am I misinterpreting the graph?
The performance of the program isn't really affected, I'm just curious.