5

Netbeans' memory monitoring tool (which is the same tool as VisualVm) has an interesting metric for tracking memory leaks : the Surviving Generations Metric.

A definition of this metric can be found on oracle.com :

  • a Generation is a set of instances created within the same GC interval (between two garbage collections)
  • a Surviving Generation is a Generation that survives at least one garbage collection. The number of survived garbage collections - the generation's age - is its unique identifier
  • Surviving Generations (metrics) value is the number of different Surviving Generations that are currently alive on the heap (number of Generations with different generation ages)

I have a question about the second definition. I know what it means for an instance to survive a garbage collection. But I'm not sure what it means for a generation to survive a garbage collection. Does it mean that at least one instance of the generation survives the garbage collection ?

Salix alba
  • 7,536
  • 2
  • 32
  • 38
barjak
  • 10,842
  • 3
  • 33
  • 47
  • Small correction: Netbeans' memory monitoring tool is not an embedded VisualVM. VisualVM contains stripped down version of NetBeans Profiler. CPU and Memory profiling in VisualVM is based on NetBeans Profiler code. – Tomas Hurka Feb 20 '12 at 13:18

1 Answers1

4

Yes. Basically that means, that among the instances, that were created between garbage collection X and X+1, there are some, that are alive now, when more garbage collections have occurred.

In my opinion, all three definitions make sense only per class. I mean, "Surviving Generations (metrics) value" of the given class is the number of different Generations of this class that are now alive on the heap.

Nikem
  • 5,716
  • 3
  • 32
  • 59
  • Yes, thanks for pointing out that NetBeans/VisualVM is able to give this metric per class. And it is indeed a very useful information for tracking memory leaks ! – barjak Feb 18 '12 at 12:25