Who is leaking memory in my Linux Jessie/KDE4 installation?

Who is leaking memory in my Linux Jessie/KDE4 installation?

Omer Zak w1 at zak.co.il
Fri Aug 29 22:24:15 IDT 2014


Hello Shimi and Oleg,
Thanks for helping me clarify what I mean by "memory leak" in this
context.

I routinely monitor memory usage by means of gnome-system-monitor, and
it appears to display memory consumption by watching the
used -/+ buffers/cache number.

As the time since last reboot lengthens, the above memory usage number
creeps upwards.  I cannot get it back to the value it had shortly after
reboot by closing all heavy applications.  This is why I am referring to
it as "memory leak".

This kind of memory usage concerns me, because when more than 90% of
memory is being used, the system slows down.  It is not because swap
memory is used (swap usage remains 0% at all times) but apparently
because there is not enough free memory to buffer/cache the entire
working set of frequently-used files.

When the system slows down, I reboot it and few more days pass before
memory usage (-/+ buffers/cache) again nears 90%.

So I am interested in finding who is hogging memory at expense of the
buffer/cache memory.  Furthermore, I'd like to find out who is hogging
more and more memory as time passes on.

--- Omer



On Fri, 2014-08-29 at 20:14 +0300, Oleg Goldshmidt wrote:
> Omer Zak <w1 at zak.co.il> writes:
> 
> > I have a 8GB PC which runs Linux Debian Jessie with KDE 4.4.
> > My problem is to find out who is occupying almost 4GB memory some time
> > after rebooting, even when nothing heavy is running.
> 
> What is your question? The subject mentions "leaking", while the body of
> your post seems to indicate (I am guessing a bit) that what bothers you
> is that most of your memory is reported as "used" rather than as
> "free" or "available". 
> 
> If an application really leaks memory you should normally be able to
> observe it by running top or similar and seeing, say, RES increasing
> with time.
> 
> If your problem is "too much memory is reported as used" then you should
> know that most of memory is "used" by something. This does not mean it
> is not available. The classic case is memory that is - or was - used for
> buffers or cache.
> 
> > However, even when they are closed, a lot memory is still reported to
> > be in use.
> 
> Operating systems do not free memory until someone requests it - again,
> your buffers and cached stuff are primary examples, as explained
> above. If you look at the "Mem" line of your top(1) or free(1) it will
> *always* report most of your memory as "used". Here is my free(1) output
> on an old laptop with 4G of RAM:
> 
> $ free
>              total       used       free     shared    buffers     cached
> Mem:       3941664    3522680     418984          0     218636    2208160
> -/+ buffers/cache:    1095884    2845780
> Swap:      6029308     113872    5915436
> 
> How much memory is used? About 1GB, actually, with ~3GB available. See
> the 2nd line, which takes into account that whatever is listed as
> buffers+cache are available for applications if/when they request it.
> 
> Check your free(1), if you see anything suspicious, post it.
>  
> > My question is: besides top, what tools can be used to find who is using
> > all this memory?
> 
> Find out the PIDs of the processes you suspect (make top sort by RES by
> typing Fq in top?) and do
> 
> egrep "^Vm" /proc/<pid>/status
> 
> for each - it will give you a lot of detailed info. If you suspect a
> leak repeat a few times while the suspect process is running (and doing
> something).
> 
> Relevant details have been discussed here before (guilty). Check
> 
> http://www.mail-archive.com/linux-il@cs.huji.ac.il/msg31797.html
> http://mailman.cs.huji.ac.il/pipermail/linux-il/2011-December/008322.html
> 
> - you will either find that useful or it will help you sleep (well).
> 
> > The next question, of course, is how to get rid of those memory hogs
> > without destabilizing the system.
> 
> First, find out if there is a problem, and what the problem is.
> 

-- 
Your liberty to swing your fist ends just where my nose begins.
Your freedom of expression ends where my freedom of expression begins.
Your freedom of religion ends where my rights for equality and
accessibility begin.
My own blog is at http://www.zak.co.il/tddpirate/

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.
WARNING TO SPAMMERS:  at http://www.zak.co.il/spamwarning.html




More information about the Linux-il mailing list