Possible working method to get actual process size on Linux

Stefan Reich stefan.reich.maker.of.eye at googlemail.com
Thu Oct 3 10:19:06 UTC 2019

I'm still trying to get Linux to report a correct process size when using
ZGC (the memory multi-mapping issue).

My idea is to parse /proc/pid/smaps. Sadly, I can't see physical addresses
there, only virtual ones. So I group by virtual address range. Here's what
I got for an example process with is reported by top as 2.7 GB:

Address range 000000xxxxxxxxxx: 6 MB
Address range 000004xxxxxxxxxx: 38 MB
Address range 000007xxxxxxxxxx: 646 MB
Address range 000008xxxxxxxxxx: 38 MB
Address range 00000bxxxxxxxxxx: 631 MB
Address range 000010xxxxxxxxxx: 38 MB
Address range 000013xxxxxxxxxx: 690 MB
Address range 00007fxxxxxxxxxx: 726 MB

It appears I have to discount the 07, 0b and 13 ranges to get to a
reasonable actual process size of 844 MB.

Question: Are these address ranges fixed or does ZGC choose different ones
depending on heap size? Where exactly do the address ranges begin and end?

As soon as this reporting method works, let's publish it as a standard tool
for anyone using ZGC on Linux. I can't be the only one who's driven nuts by
not knowing how big my processes are.


Stefan Reich
BotCompany.de // Java-based operating systems

More information about the zgc-dev mailing list