how to track down a mem leak?

wwp subscript at free.fr
Mon Jun 19 20:18:30 UTC 2006


Hello Colin,


On Sun, 18 Jun 2006 21:55:45 +0200 "Colin Brace" <cb at lim.nl> wrote:

> Hi all,
> 
> I am running FC5 with the latest kernel (2.6.16-1.2133). Just now my
> system seems to have choked up from a memory leak. I ssh'ed in from a
> laptop and 'top' indicated that all the virtual memory was in use, but
> alas the system became unresponsive and I could not further
> investigate what in particular was the memory hog. At that point, the
> box didn't even respond to ctr-alt-backspace, so I had to hit the
> power switch.
> 
> Is there any way of logging memory use? Any other suggestions as to
> how to track down what went wrong?

Just my 2 cts. It's possible that your system gets very slow (slow as it's
not even responsive), BUT that after a while, the kernel kills the process
that is eating too much memory (when kernel is not able to make new
allocation for it). Even once killed, your system won't get that fast before
a possibly long time, still because of pages that reside in swap.
<parenthese> This recently happened to me, running ldd (eating 400MB) while a
vmware host was running (400 too) and other pieces of software (mail,
browser, etc.) on a 1GB+1GBswap machine. System was simply unusable even when
I closed the vmware and ldd stopped, had to reboot. </parenthese> This
example shows that it's hard to get back from such situation.

If you're not sure of what is the faulty app, start top in a terminal as soon
as you can (press M to sort by memory eating), then regularly watch at until
you see smth interesting. You can also track memory information from `free`
or some entries in /proc. You can then run the faulty app from valgrind in
order to see what are the leaks.. if the app is compiled w/ symbols. Running
from within valgrind is horribly slow, and I only do that for apps I'm
writing/debugging, rarely for other software (unless I'm tracking down a bug).

Good hunting!


Regards,

-- 
wwp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20060619/734c5419/attachment-0001.sig>


More information about the fedora-list mailing list