[lkml]   [2005]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Kernel doesn't free Cached Memory

On Fri, 22 Jul 2005, Bernd Petrovitsch wrote:

> On Fri, 2005-07-22 at 08:27 -0300, Vinicius wrote:
> [...]
>> I have a server with 2 Pentium 4 HT processors and 32 GB of RAM, this
>> server runs lots of applications that consume lots of memory to. When I stop
>> this applications, the kernel doesn't free memory (the memory still in use)
>> and the server cache lots of memory (~27GB). When I start this applications,
>> the kernel sends "Out of Memory" messages and kill some random
>> applications.
>> Anyone know how can I reduce the kernel cached memory on RHEL 3 (kernel
>> 2.4.21-32.ELsmp - Trial version)? There is a way to reduce the kernel cached
>> memory utilization?
> Probably RedHat's support can answer this for RHEL 3.
> Bernd
> --

> Firmix Software GmbH
> mobil: +43 664 4416156 fax: +43 1 7890849-55
> Embedded Linux Development and Services

How do you know the memory is "still in use?"
I think that if you run a program that uses so
much memory that some swap is used, but not
allowing all free memory to be exhausted, you
can run the same program over and over again
forever. Therefore, the memory must have been
freed and available for the next time you
run the program.

The problem is that you are exhausting all
free memory causing the kernel to kill processes
just to stay alive. Then you look at some
memory "tool" and think that it shows something
about what is, or has been freed. You need
to set process limits on the amount of resources
each process can use and, depending upon the
implementation details of your "server", you
might even need to turn memory over-commit off:
echo "0" > /proc/sys/vm/overcommit_memory

The fact is that unused memory is stored in
caches and buffers. That's how it doesn't
get wasted. In fact, with a busy system
an attempt is made to use all available
real RAM and minimize swap.

Some server programs are written much like
your defective test program. You can't
attempt to allocate all virtual memory
using malloc(), expecting it to return
NULL when there is no more. Malloc() will
return NULL when it has gotten trashed
by somebody overwriting buffer boundaries
or when address-space is exhausted.

It has no clue how much RAM is available
and, in fact if it did, it would represent
an information leak. Programs should
allocate what they need, not what they
can get.

Dick Johnson
Penguin : Linux version 2.6.12 on an i686 machine (5537.79 BogoMips).
Warning : 98.36% of all statistics are fiction.

The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-07-22 15:11    [W:0.043 / U:43.884 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site