RFR(xs): 8251255: [linux] Add process-memory information to hs-err and VM.info

Thomas Stüfe thomas.stuefe at gmail.com
Thu Aug 6 14:01:44 UTC 2020


Hi,

may I please have reviews for this addition:

JBS: https://bugs.openjdk.java.net/browse/JDK-8251255
Webrev:
http://cr.openjdk.java.net/~stuefe/webrevs/8251255-add-rss-to-hs-err/webrev.00/webrev/

When analysing a customer memory leak recently I found for all
the information we have in the error files we miss some really fundamental
statistics like process virtual size and rss. Either that or I am blind :)

In case I am not blind this patch adds those statistics. I decided against
dumping proc files wholesale to the hs-err file, I just print out what I
really find useful.

Note that among other things I print out the total size of outstanding heap
allocations. Note that still the best way to do this is via mallinfo, and
that means the returned value is int and may wrap, see coding and comment.
Even with this caveat though this info is still very useful.

I did a number of manual tests, the numbers seem legit.

Looks like this:

Process Memory:
Virtual Size: 7494372K (peak: 7559908K)
Resident Set Size: 271264K (peak: 571348K) (anon: 226460K, file: 44804K,
shmem: 0K)
Swapped out: 0K
C-Heap outstanding allocations: 37845K


Here I simulate a C-Heap memory leak:

Process Memory:
Virtual Size: 9062260K (peak: 9118772K)
Resident Set Size: 1941776K (peak: 1941776K) (anon: 1896872K, file: 44904K,
shmem: 0K)
Swapped out: 0K
C-Heap outstanding allocations: 1291984K


Same leak, with the mallinfo value wrapped around:

Process Memory:
Virtual Size: 12343352K (peak: 12445556K)
Resident Set Size: 5232084K (peak: 5281512K) (anon: 5187052K, file: 45032K,
shmem: 0K)
Swapped out: 0K
C-Heap outstanding allocations: 15454K (may have wrapped)

Thanks, Thomas


More information about the hotspot-runtime-dev mailing list