Possible working method to get actual process size on Linux

Stefan Reich stefan.reich.maker.of.eye at googlemail.com
Thu Oct 3 13:07:57 UTC 2019


My bad, I have a function called usedMemory() which is
totalMemory()-freeMemory().

On Thu, 3 Oct 2019 at 14:59, Per Liden <per.liden at oracle.com> wrote:

> On 10/3/19 2:47 PM, Stefan Reich wrote:
> > The situation is still confusing. My process has:
> >
> > Runtime.totalMemory() = 2.7 GB
>
> This is the current Java heap capacity (some of it may be free/available
> for new allocations).
>
> > Runtime.usedMemory() =~ 1 GB
>
> There is no Runtime.usedMemory(), so I don't know where this number
> comes from.
>
> >
> > ps_mem.py says:
> >
> > root at smartbot:~/bin# ps_mem.py -p 4837
> >   Private  +   Shared  =  RAM used Program
> >
> > 745.5 MiB +   2.4 GiB =   3.1 GiB java
> > ---------------------------------
> >                            3.1 GiB
>
> This is the total process size, i.e. Java heap, jitted code, VM data
> structures, etc.
>
> >
> > Is the heap counted as shared memory here? The shared memory value seems
> > way too large.
>
> Yes, the ZGC heap is mapped as shared memory.
>
> /Per
>
> >
> > My own tool reports < 1 GB as RSS which seems way too low...
> >
> >
> > On Thu, 3 Oct 2019 at 14:32, Per Liden <per.liden at oracle.com
> > <mailto:per.liden at oracle.com>> wrote:
> >
> >
> >     On 10/3/19 2:23 PM, Stefan Reich wrote:
> >      > Hi Per!
> >      >
> >      > Yes, I saw, sorry for not responding the other time.
> >      >
> >      > This problem is, /proc/*/smaps_rollup doesn't exist on one of my
> >      > machines (the one with the oldest kernel). On the newer machines,
> >     yeah,
> >      > it may be an option to use PSS from smaps_rollup.
> >      >
> >      > Not sure if there are any tools which would help here.
> >
> >     I know some of them (e.g. ps_mem.py), works on older kernels that
> >     doesn't have /proc/<pid>/smaps_rollup.
> >
> >     cheers,
> >     Per
> >
> >      >
> >      > Greetings,
> >      > Stefan
> >      >
> >      > On Thu, 3 Oct 2019 at 14:16, Per Liden <per.liden at oracle.com
> >     <mailto:per.liden at oracle.com>
> >      > <mailto:per.liden at oracle.com <mailto:per.liden at oracle.com>>>
> wrote:
> >      >
> >      >
> >      >     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?
> >      >
> >      >     cheers,
> >      >     Per
> >      >
> >      >
> >      >
> >      > --
> >      > Stefan Reich
> >      > BotCompany.de // Java-based operating systems
> >
> >
> >
> > --
> > Stefan Reich
> > BotCompany.de // Java-based operating systems
>


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


More information about the zgc-dev mailing list