-   Linux - General (
-   -   Memory Utilization Question (

toddclark 11-02-2000 02:02 AM

I have been battling a problem with a newly installed web server which I have had online for about two weeks now.

I started with a Redhat 7 box running MySQL and Apache complete with 256mb of RAM. After about a day the system would freeze completely. I never got a message as why it was crashing until the final one when I saw the screen said something to the effect there was not enough SWAP. Hmmm, it was working fine and showed plenty of memory when I booted it up.

So I installed another 256mb of RAM and let it run. Throughout the day I watched the memory drop from 400mb available to 10mb available. Then it started eating into the swap:

From top:

Mem: 516072K av, 499196K used, 16876K free, 39208K shrd, 225204K buff
Swap: 160608K av, 704K used, 159904K free 207812K cached
Like a virus the swap is being utilized more and more. 20 minutes ago it was using 500k, now it is 704k.

What is going on here? Is this what is known as a memory leak? How do I find out where the leak is?

I have heard from some that Linux will utilize RAM not being used and release it as needed. If this is true why is it using the swap. I always thought swap was for emergencies when resources are low. With 512mb of ram and at a quiet time of the day should it even be dipping into the swap?

Larry James 11-04-2000 06:05 PM

Someone might have a more direct approach, but a general approach to analyze this is to write a routine that will report your memory usage.

Write a bach file called, for instance, with the fillowing lines:


while [ 1 = 1 ]
top -c -n1 > top.out.$$
sleep 300

This will create an output file every five minutes, with a unique number extention. You can execute it in it's own separate terminal screen or execute it in the background with:


Since it'll make 12 files an hour, you might want to put it in it's own subdirectory so that you can easily sort them or remove then when you finish the task.

You should now easily be able to identify which programs are starting to consume your resources.

-- L. James

All times are GMT -5. The time now is 06:53 AM.