How to find out what process are eating all memory
Im using SUSE, i have 31GB of memory Mem: 31908592k total, 31429632k used, 478960k free, 12176k buffers How do I find out what process are eating up all my memory.
Looks like you're running free
, looking at the first line, and freaking out. That's OK; a lot of people do that.
Ignore the first line of output from free
. Really. Linux is very aggressive about caching data from disk, even including "swapped out" virtual memory pages, in RAM and all that cached data is counted as "used" in free
's first line, even though it can be made available again in a microsecond (or less, these days) if needed.
You need to be looking at the second line of output from free
, the one labeled -/+ buffers/cache:
. That's the line which will tell you how much memory is actually tied up by running programs, ignoring what's being used for the moment by buffers and cache.
For example, my machine currently shows:
total used free shared buffers cached
Mem: 3083924 2177300 906624 0 461344 837008
-/+ buffers/cache: 878948 2204976
Swap: 4000148 0 4000148
Although there are only 906624 bytes of RAM sitting completely unused at the moment, there are an additional 461344 bytes of buffers and 837008 bytes of cached data which can be made available more-or-less instantly if something more important (i.e., just about anything) needs the memory, giving me a total of 2204976 bytes actually available to me.
Run top
, then press ShiftO, then N, then finally Enter. Press Q when you want to exit.
And don't forget, "Linux ate my RAM!".