When java heap is used by many java.lang.String or “Class [C” , it is often difficult to get a high level picture. Below is a screen capture of firefox browser accessing ‘jhat’ . I thought I would create histogram for numbers in red rectanble. i.e.) (NNNNNN bytes).
From quick browsing of this page, I knew that largest number is 2.3MB. So I decided to bin(bucket) every 10000 bytes and show sum().
There may be many ways to this. I used #qtextasdata.
$ curl --silent http://localhost:8001/class/0x703af77a8 | sed -rn 's/^<a .* \(([0-9]+) bytes\).*$/\1/p' | sort -n|uniq -c | q 'select sum(c1*c2),c2/10000 from - group by c2/10000' 162529307 0 388236 1 158056 2 269652 3 [... continue ...]
Above doesn’t fill the vacant bin with ‘0’ but I think this is good enough to know the distribution and find memory leak suspects.