[vox-tech] Memory usage puzzle

M E vox-tech@lists.lugod.org
Sat, 19 Jan 2002 18:59:36 -0800


My first post from here, so I hope it does not do HTML...

Keywords: memory use, process resources, ps vs. free, lost memory

On Wed, 16 Jan 2002, Rod Roark wrote:
>Anyone know a good utility that will go through all allocated memory
>blocks and tell you which process or executable is responsible for
>each one?
>
>Yes I know about "ps".  I don't think it really does that.  Here's my
>problem:
>
>When I start up my colo box, running ntpd, bind, sshd, postfix
>Courier pop3d/imapd, apache, postgresql, xvnc, one KDE session, and
>some other normal stuff, "free" shows about 60 MB in use (after
>subtracting buffers and cache).  After a day or two, memory usage
>climbs to around 260MB and stays there.  If I stop VNC/KDE, apache,
>all mail stuff and the sql server, memory in use still stays over
>about 220 MB.
>
>So, what's using all that memory?  I'd like to find out.
>
>Total physical memory is 1GB.

Shared library files, disk cache/buffers are 2 big ones. Why free up
memory for library files that are frequently used? (Especially when nothing 
else needs the memory anyway.)

Check out another command that map help and provide you with too much
information and it may help you when used with ps and assorted other
flags:
# lsof

The above will show you lists of open files. Among these files will include 
some of the library files and ".so" that have been loaded
into memory (cached). This probably does not report on buffer space. I 
*think* the buffer space is used by some of the "special" devices in the 
/dev/ dir much like a buffer would be expected to be used. (Block buffer 
space may not be listed here from lsof.)

At first, leaving these libs in memory bugged me, but when I realized it
did not hurt anything and they would be removed if unused *and* something 
else needed memory, it did not mind so much. It really saves time to have 
them loaded if you have no other use for the memory.

As a test, try unloading all of the aps like before, but then run gimp and 
create a really huge image (900Mb for example) and then quit gimp after you 
are done to see how much memory you free. It is likely that you will have 
more memory freed because those unused libs that were cached in memory were 
taken out.

As another test. After you reboot your machine, run free. Next, start 
netscape from the command line and time how long it takes from the press of 
thr return until you see netscape show up on the desktop. Then quit out of 
netscape. Now run free again and compare the differences. Now again, start 
Netscape from the command line and time how long it takes to start up. The 
change is time is likely to be almost based on libs that were needed by 
Netscape were cachesd in memory the first time you loaded it. Another test? 
Once one copy is running, see how much less time it takes for a second copy 
to start compared to the first one, and how much memory - incrementally was 
used in the second instance vs the first one. (You may be surprised.)

another command that is much less verbose:
# free
(I saw in the thread you know this one)

Also check out
# gps
and for fun an happiness (not much in the way of raw numbers)
# lavaps
(Fun to watch on busy systems with lots of users in big screen format.)

(Answer above plagiarized without reference from some "dumbass" ;-)


-Some random guy on the internet. REALLY! Why don't you believe me?



_________________________________________________________________

Please be sure that you NEVER, EVER even THINK about trying to



_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com