5

I have a computer with 16GB of ram. At the moment, top shows all the RAM is taken, (NOT by cache), but the RAM used by the various processes is very far from 16GB.

I have seen this problem several times, but I don't understand what is happening. Any clues? My only remedy so far has been to reboot the machine.

Peltier
  • 6,504

2 Answers2

8

As I understand it, on Linux 'used' memory is split into 'active' and 'inactive'.

Active memory is memory which is currently allocated to a process and in use by it.

Inactive is memory that has been allocated to a process but is no longer in use by it (it has been free()d). The allocator puts this memory on one side for later use, but doesn't empty it. If the same data that is in that memory block is requested again it just re-allocates that memory block to the process. If a block of memory is requested and there is no 'clean' memory left it starts re-allocating this 'dirty' memory.

Examining /proc/meminfo can show you how much of your 'used' memory is active and how much is inactive.

Majenko
  • 32,964
1

Ensure some swap is enabled and swappiness is nonzero. Swap utilization usually signifies whether there is actual pressure on memory instead of just buffers/cache temporarily occupying what's available.

dhchdhd
  • 198