I have a web server running Apache that has some interesting numbers for memory usage.

Looking at top I have the following memory information

Mem:  11679976k total, 10917568k used,   762408k free,   384320k buffers
Swap:  4194296k total,        0k used,  4194296k free,  1103728k cached

So subtracting buffers and cache there is approxmiately 9GB or so of memory being used. free -m confirms this.

             total       used       free     shared    buffers     cached
Mem:         11406      10642        763          0        375       1077
-/+ buffers/cache:       9189       2217
Swap:         4095          0       4095

This web server is quite busy so when we turn off apache we would expect this memory usage to drop drastically, but it doesn't drop much at all.

How can I find what is really using up all that memory? From tops output after shutting down apache nobody is using much memory. This tells me no one is using that memory, but the system is reporting it is being used.

We have had several servers crash because the memory was used up so we're trying to understand better what is going on.

  • when you run top, do you sort fields by memory or use default CPU?
    – Petter H
    Oct 24, 2013 at 18:14
  • Please provide the output of /proc/meminfo Oct 24, 2013 at 18:47

1 Answer 1


Check out /proc/meminfo and /proc/slabinfo. The slabtop command may help you with understanding the slabinfo contents.

There are caches that can consume memory but aren't categorized as cache or buffers by top / free. inode and dentry come to mind (particularly if you have extensive filesystems).

  • Slabinfo indicates that I have huge number of dentry objects. Does the memory get reclaimed if an application needs it?
    – morgana
    Oct 24, 2013 at 18:55
  • I believe so, but the impact to performance when you lose that cache is always going to depend on the nature of your application. You can drop the cache by echoing various values to /proc/sys/vm/drop_caches (google them). You can also just run a simply "bloat" process to soak up memory and watch how the system behaves. For example, run perl -e 'foreach $x (1..BIGNUMBER) { $y{$x} = $x; }' and adjust up the number to increase the memory consumption. Oct 24, 2013 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.