Possible working method to get actual process size on Linux

Per Liden per.liden at oracle.com
Thu Oct 3 12:16:36 UTC 2019


On 10/3/19 12:19 PM, Stefan Reich wrote:
> 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?

ZGC in JDK 11 & 12 always used a fixed size and location, but that's not 
the case in later JDK versions, where this can vary depending on 
configuration and runtime conditions.

> 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.

Did you see my reply to your previous question on this topic? Tools to 
extract this data (PSS) exist. Are they not doing what you want?


More information about the zgc-dev mailing list