0

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?

Nisarg
  • 109
  • 8

1 Answers1

1

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.

Nisarg
  • 109
  • 8
  • To complete the answer, you should add the name of the wrapper, how you invoked it and how you managed to avoid it (and get the right numbers). IMHO such a wrapper can be useful, but it must in no case take the place of the original bean. – maaartinus Oct 01 '19 at 07:18
  • @Nisarg, I doubt it is from the start of the JVM because I am seeing values going up and down. Please share your findings. – CrazyCoder Jun 09 '22 at 13:59