I'm running Amazon Linux on a machine with 16GB. I have two java processes that are maxed out at 2GB each. One process that grabs 2GB upon startup and another that can grow up to 2GB. The other processes don't seem to consume much memory at all. But, most of my memory is consumed from looking at top:

 Mem:  16426080k total, 13986456k used,  2439624k free,   316888k buffers

The ps aux output:

app1 30213 6.2 40.3 16615384 6632692 ? Sl 14:54 5:28 app2 30469 10.5 9.6 5847412 1589996 ? Sl 14:54 9:12

I can't seem to figure out where all of my memory has gone. At best my 2 main processes are using 4gb total so where is the other 12GB? Seems excessive that the OS would eat up all of that memory. How can I free up more memory?

2 Answers 2


As Denis mentioned Linux tries to use all the memory it can, rather than just have it sit there idle. So one big thing it does is cache files to memory. This helps speed up reads, and depending on the tool you use it can confuse what you are seeing.

I've not got an Amazon Linux box near me right now, but I think you're missing some details.

Here's an output from my openSuSE box, for free:

              total        used        free      shared  buff/cache   available
Mem:       32800876     6833072    14617720      717928    11350084    24946896
Swap:      16777212           0    16777212

So I've got 32G of Memory in my system, almost 7G used, and over 14G "free". But if you see that buff/cache at the end, thats actually available for programs too. Linux will de-allocate from that cache to programs. Additionally, depending on how its feeling for the day (yes there is an algorithm for this) it may move something off to SWAP even if you have free memory.

So I would only be really concerned if your cache is very small as well. That would indicate you're not using the FS cache on the system, and you do have something "mystery" eating up memory. If so digging more into the top output would be required.

  • Ok that helps. I remember looking into this before and finding out it was mostly linux cache, but the details slipped my mind. Here is my free -m output: total used free shared buffers cached Mem: 16041 13621 2419 0 230 11225 -/+ buffers/cache: 2165 13875 Swap: 0 0 0 I think that shows the cache is being used. I do have some stability issues with my 2 java programs which I think are running out of memory because it's tight. Feb 6, 2021 at 0:07

Linux OSs normally utilize almost all RAM without actually actively using it all, so it works more efficient. So if you don't have apps slowing down, due to swapping, which most likely you don't (in your case), there is no reason to worry. Only if Free Mem goes down to sub 300-500k they you are likely utilizing a large portion, and it would be good add ram, or stop some applications

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.