I would like to get the equivalent of the ouput of jmap -histo programmatically, from inside the monitored application. I see triggering a binary heap dump is p
jmap -histo
It may be not the best example/code, but have a look at this
(I think it's only working on Hotspot JVMs)