Memory consumed quickly on my server [duplicate]

Don't confuse free memory with unused memory. Free memory, in the unix world is a page of physical memory that has no logical data mapped to it. Unused memory does have some data mapped to it, but it is currently not in active use by a running process.

% free -m
             total       used       free     shared    buffers     cached
Mem:           997        942         55          0         71        366
-/+ buffers/cache:        504        492
Swap:         2015        618       1397

Linux (and all Unix OS'es) try to have as little free memory as possibly. Instead they use memory which is not actively mapped to processes in the running OS for things like file cache and buffers for various IO transfer operations.

Something else that may be confusing you is you cannot simply add up the memory in use by all running processes to get a total memory in use figure. If you attempted this you would quickly discover that you applications appear to be using more memory than actually exists on the machine. This is for two reasons

  1. Memory can be shared between various processes, through Copy-On-Write memory allocation, memory mapped IO and shared dynamic libraries.
  2. The operating system is at liberty to promise more memory to the application than it has actually supplied. The theory being that most application writers prefer to ask for large amounts of memory in one go, to avoid overhead, and may not actually use all that memory.

There is a recent article on lwn.net discussing this issue.


Linux will actively cache file system accesses into memory to give faster disk access times. It is nothing to worry about.

Running free -m on the box will give you a better idea of where memory is being used.

Below is the output pulled from one of my boxes. Free memory is 147Meg with almost 4G cached for file system access requests.

free -m
             total       used       free     shared    buffers     cached
Mem:          6035       5888        147          0         77       4116
-/+ buffers/cache:       1693       4341
Swap:         4722          0       4722

Are you also including the "buffered" and "cached" fields?


With linux, look at Committed_AS in /proc/meminfo, this is the amount of memory (real + swap) that the kernel has actually promised to running processes.

Linux uses memory very efficiently, any blocks not promised to some process is used to cache recently/frequently accessed files. So, it is typical for Linux to use 90% of all available physical memory not long after boot.

Look at what the kernel has committed itself to providing .. and dirty (swap) usage, this gives you a better overall picture.

If you need to adjust this behavior, please update your question :)

This is the standard MO for Linux.. some distros tweak memory management to suit their needs via sysctl. However, what you report is pretty typical amongst all.


What kind of kernel are you running on the system? A 32-bit kernel will only report around 3.6GB of memory, unless compiled with PAE enabled.

Saying that, if this is a modern version of Redhat Enterprise Linux (or CentOS) - v3 onwards - the default 32-bit kernel will have this enabled.

If you could post the output of the 'free' command detailed above, we will be able to see whether or not this is the problem.