Who is leaking memory in my Linux Jessie/KDE4 installation?
Oleg Goldshmidt
pub at goldshmidt.org
Fri Aug 29 20:14:27 IDT 2014
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.
--
Oleg Goldshmidt | pub at goldshmidt.org
More information about the Linux-il
mailing list