GarbageCollectorMXBean getCollectionCount :: Returns the total number of collections that have occurred

166 Views Asked by At

The doc for GarbageCollectorMXBean getCollectionCount says Returns the total number of collections that have occurred, is it from the start of the time of start of JVM?

From what I am seeing it looks like the number of GCs from the last poll on getCollectionCount. Where can I see a sample (maybe G1GC) implementation for GarbageCollectorMXBean?

1

There are 1 best solutions below

2
Nisarg On

GarbageCollectorMXBean indeed returns total number of collections that have occurred since the start of the JVM.

What I was looking at was a wrapper over GarbageCollectorMXBean which used to explicitly maintain the lastValue & emit the difference.