Search code examples
javamemoryheap-memoryjvm-hotspotheap-dump

How to get jmap histogram programmatically?


I would like to get the equivalent of the ouput of jmap -histo programmatically, from inside the monitored application. I see triggering a heap dump is possible through the HotSpot diagnostic bean, but I can't see how to get the histogram data. Is it possible ?


Solution

  • It may be not the best example/code, but have a look at this

    (I think it's only working on Hotspot JVMs)