What is "residual memory"? Can anyone explain?

What is "residual memory"? Can anyone explain?

Raz raziebe at gmail.com
Fri Dec 16 21:22:43 IST 2011


i tend to calculate a process' memory consumption in deltas, meaning,
how memory it consumes in addition to the shared sections. So i
usually take a look at the write-able
and private consumption as reported by pmap. ( pmap <pid> ).
Please note, there are numerous discussions of how to estimate
system/process memory consumption. Consider for example an in-kernel
inode, it is not counted in the process address space even though it
serves "the process", what about in-flight bio, skbuff ?


These problem are very common in the embedded world, we  fear of being
"oomed" :)



On Fri, Dec 16, 2011 at 3:34 PM, Oleg Goldshmidt <pub at goldshmidt.org> wrote:
>
> Shlomi Fish <shlomif at shlomifish.org> writees:
>
> > Hi all.
> >
> > I reported a bug in Amarok (
> > https://bugs.kde.org/show_bug.cgi?id=288876 ) where it sometimes
> > consumes over 10% of my RAM on startup, and it was closed with this
> > comment:
> >
> > <<<< Well, there is the virtual memory but it is the residual memory
> > use that matters. Yours us just 371M which is absolutely correct.
> > FWIW: I suggest you read up some documentation on dynamic memory use
> > in Linux.  In short: the more memory available, the more will be
> > used, the system distributes this evenly to the running processes
> > depending on their priority.
> >
> > Not a bug.
> >>>>>
> >
> > Well, I don't understand it. What is "residual memory" in this
> > context (as Google searches for it yields junk.), and why is still
> > OK that Amarok consumes so much.
>
> Well, there are two issues here.
>
> 1. I suspect/assume that "residual memory" means "resident set"
>   (someone confused "resident" with "residual"?). This is the total
>   size of pages mapped in RAM, per process, without VM or process
>   kernel data structures. This has been discussed here before, e.g.,
>
> http://www.mail-archive.com/linux-il@cs.huji.ac.il/msg31797.html
>
> 2. What was it that you considered a bug? The screenshot of top in
>   your bug report shows resident set size (a.k.a. RSS, RES field in
>   top) of 387M, which is consistent with 12.9% of your total 3G of
>   RAM. If this is your complaint (why the process uses so much RAM?)
>   then someone did not read your report attentively enough - I mean,
>   the response can be (mis)construed as "you've looked at a wrong
>   field".
>
>   At the same time, it is not at all clear why they should consider
>   it a bug. Out of curiosity, I started amarok on my F14 box and its
>   RSS is 90M (without doing anything at all). There are other
>   processes (quite a few) running on the machine right now, and this
>   may explain why it is smaller than in your case (you did a "clean"
>   experment, didn't you?). The app may allocate and preload/cache
>   all sorts of stuff if it can - if there is memory available, why
>   withhold it? This is what they told you, in different words.
>
>   Finally, I did
>
>   egrep "^Vm" /proc/<pid>/status
>
>   and the app's heap is almost 10 times larger than RSS, i.e., stuff
>   was allocated but not mapped. Maybe this is what they had in mind
>   when they said that RSS is what matters. Another datum - the size
>   of shared libraries used, is also significantly (50%) more than
>   RSS. And if you note that RSS counts shared pages as belonging to
>   the process (since they are mapped into the process's virtual
>   memory space) it stops looking so badly.
>
> Hope something is clearer than it used to be.
>
> --
> Oleg Goldshmidt | pub at goldshmidt.org
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il



More information about the Linux-il mailing list