With Mustang (Java SE 6), there are atleast 4 ways to get histogram of Java heap:
jmap -histo <pid-of-java-process>
jmap -dump:format=b,file=heap.bin <pid-of-java-process>
jhat heap.bin
When jhat is started, visit the URL "http://localhost:7000/" and click on "Show heap histogram" link to view the histogram.
hotspot$1:::object-alloc {
self->str_ptr = (char*) copyin(arg1, arg2+1);
self->str_ptr[arg2] = '\0';
self->classname = (string) self->str_ptr;
@allocs_count[self->classname] = count();
@allocs_size[self->classname] = sum(arg3);
}
Posted by Alan on February 17, 2006 at 05:26 PM IST #