old-www/LDP/LG/issue30/tag_memleak.html

159 lines
6.6 KiB
HTML

<!--startcut ======================================================= -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<META NAME="generator" CONTENT="lgazmail v1.1pre8">
<TITLE>The Answer Guy 30: Linux Memory Usage vs. Leakage</TITLE>
</head>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ========================================================= -->
<H4>"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <hr> <P>
<!-- =============================================================== -->
<H1 align="center"><A NAME="answer">
<img src="../gx/dennis/qbubble.gif" alt="" border="0" align="middle">
<a href="./index.html">The Answer Guy</a>
<img src="../gx/dennis/bbubble.gif" alt="" border="0" align="middle">
</A></H1> <BR>
<H4 align="center">By James T. Dennis,
<a href="mailto:linux-questions-only@ssc.com">linux-questions-only@ssc.com</a><BR>
Starshine Technical Services,
<A HREF="http://www.starshine.org/">http://www.starshine.org/</A> </H4>
<p><hr><p>
<H3><img src="../gx/dennis/qbub.gif" alt="(?)" width="50" height="28"
align="left" border="0">Linux Memory Usage vs. Leakage</H3>
<p><strong>From Kevin Monceaux on 27 May 1998
<!-- begin body -->
<BR><BR>
Dear Answer Guy,
<br><br>
HELP!!!!!!!!!!!
<br><br>
I really enjoy "The Answer Guy" column, and I hope you can help me with
this one. I'm running Linux 2.0.29. I've been using this version for
quite a while now. Up until now everything's been fine. A couple of
days ago the problem developed. What appears to be happening is that
when programs are run they are not deallocating the memory they used.
Upon first booting the system there is already almost 9 megs of RAM in
use. I've run free to check the memory usage, ran another command, such
as ls, then ran free again and the free memory decreases. I've noticed
that if I run the same command, such as <TT>ls</TT>, again the memory
usage stays the same. It's only when commands that haven't been executed
before are run that the amount of free memory decreases. It doesn't take long
before I'm out of memory and have to reboot. Any suggestions you could
give me with this problem would be greately appreciated.
<br><br>
Thanks in advance,
<br>Kevin Monceaux
</strong></p>
<blockquote><img src="../gx/dennis/bbub.gif"width="50" height="28" alt="(!)"
align="left" border="0">
If you suspect a memory leak I highly recommend getting
a log of your '<TT>free</TT>' or '<TT>vmstat</TT>' output before and
after a few commands -- several snapshots.
<br><br>
You can make a <TT>cron</TT> job to mail you a snapshot of this
every hour or so. You might want to append the output
of a <TT>ps</TT> command to each of these e-mail snapshots.
<br><br>
Unfortunately it isn't as easy to interpret the output of
these commands as it should be. It's entirely too easy
to misinterpret the output fields from them -- since Linux
normally uses most of the available memory for file
cache buffers -- and large portions of the shared libraries
and memory allocated to forked process is shared (the
memory manager uses "copy-on-write" and other techniques
to minimize the utilization of physical memory). This
makes correlating actual memory usage difficult.
<br><br>
You can also use '<TT>top</TT>' (which is a curses process viewer).
It can show you the current state of the system and sort by
memory (M) or CPU utilization (P). You want to isolate the
specific process(es) that is(are) causing the problem. Don't
leave '<TT>top</TT>' running unattended, however, since it is a bit of
a resource hog in its own right.
<br><br>
If you do isolate this to a particular program you'll want
to see if there are updates available for it, or for any of
the libraries it uses. You may also want to consider getting
a newer kernel --- such as 2.0.33 or (if it's ready by the
time you read this: 2.0.34).
<br><br>
Sorry I can't be more specific --- but you'll have to
narrow down the problem a bit before we can do more. Incidentally
you can start up in single user mode and manually start all of the
daemons and processes that you normally run your multi-user
(initdefault) mode. Do this slowly, one command/daemon at a
time, to see when the problem first appears. If it happens
right away then boot with the -b option to prevent the
execution of any of your boot up scripts and manually load
any kernel modules you're using one at a time.
</blockquote>
<!-- end body -->
<!--================================================================-->
<P> <hr> <P>
<H5 align="center"><a href="http://www.linuxgazette.com/copying.html"
>Copyright &copy;</a> 1998, James T. Dennis <BR>
Published in <I>Linux Gazette</I> Issue 30 July 1998</H5>
<P> <hr> <P>
<!--================================================================-->
<table width="98%"><tr valign="center" align="center">
<td rowspan="3"><A HREF="./lg_answer30.html"><IMG
SRC="../gx/dennis/answernew.gif"
ALT="[ Answer Guy Index ]"></A></td>
<td><A HREF="tag_SCOkeys.html">SCOkeys</A></td>
<td><A HREF="tag_chroot.html">chroot</A></td>
<td><A HREF="tag_dosemu-db.html">dosemu-db</A></td>
<td><A HREF="tag_NTauth.html">NTauth</A></td>
<td><A HREF="tag_cdr.html">cdr</A></td>
<td><A HREF="tag_3270.html">3270</A></td>
<td><A HREF="linux-questions-only@ssc.comport.html">comport</A></td>
</tr><tr valign="center" align="center">
<td><A HREF="tag_lilostop.html">lilostop</A></td>
<td><A HREF="tag_emulate.html">emulate</A></td>
<td><A HREF="tag_ppadrivers.html">ppadrivers</A></td>
<td><A HREF="tag_database.html">database</A></td>
<td><A HREF="tag_vacation.html">vacation</A></td>
<td><A HREF="tag_nullmodem.html">nullmodem</A></td>
<td><A HREF="tag_lockups.html">lockups</A></td>
</tr><tr valign="center" align="center">
<td><A HREF="tag_gzipC.html">gzipC</A></td>
<td><A HREF="tag_newlook.html">newlook</A></td>
<td><A HREF="tag_c500.html">c500</A></td>
<td><A HREF="tag_solprint.html">solprint</A></td>
<td><A HREF="tag_vc1shell.html">vc1shell</A></td>
<td><A HREF="tag_memleak.html">memleak</A></td>
<td><A HREF="tag_tvcard.html">tvcard</A></td>
</tr></table>
<P> <hr> <P>
<!--================================================================-->
<A HREF="./index.html"><IMG SRC="../gx/indexnew.gif"
ALT="[ Table Of Contents ]"></A>
<A HREF="../index.html"><IMG SRC="../gx/homenew.gif"
ALT="[ Front Page ]"></A>
<A HREF="lg_bytes30.html"><IMG SRC="../gx/back2.gif"
ALT="[ Previous Section ]"></A>
<A HREF="./vrenios.html"><IMG SRC="../gx/fwd.gif"
ALT="[ Next Section ]"></A>
<!--startcut ======================================================= -->
</body>
</html>
<!--endcut ========================================================= -->