RPI model B eats memory?

Sep 23, 2015 2 Replies

Hi all; I use an headless rpi with debian wheezy. I can't understand why the available memory decreases, as stated by top:


Boot, start tmux or screen:



top - 10:18:10 up 15 min, 1 user, load average: 0.07, 0.04, 0.07 Tasks: 82 total, 1 running, 81 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.3 us, 1.3 sy, 0.0 ni, 98.3 id, 0.0 wa, 0.0 hi, 0.0 si, KiB Mem: 494572 total, 75496 used, 419076 free, 12872 buffers KiB Swap: 102396 total, 0 used, 102396 free, 35484 cached


After starting tmux sessions (mail, web, torrent, shell)



top - 10:20:46 up 18 min, 1 user, load average: 0.20, 0.12, 0.10 Tasks: 96 total, 1 running, 95 sleeping, 0 stopped, 0 zombie %Cpu(s): 6.7 us, 1.7 sy, 0.0 ni, 89.9 id, 0.0 wa, 0.0 hi, 1.7 si, KiB Mem: 494572 total, 127240 used, 367332 free, 16248 buffers KiB Swap: 102396 total, 0 used, 102396 free, 52616 cached


After some hours (normal run)



top - 09:51:37 up 11:26, 1 user, load average: 0.05, 0.04, 0.05 Tasks: 96 total, 1 running, 95 sleeping, 0 stopped, 0 zombie %Cpu(s): 4.3 us, 1.7 sy, 0.0 ni, 94.1 id, 0.0 wa, 0.0 hi, 0.0 si, KiB Mem: 494572 total, 478880 used, 15692 free, 74304 buffers KiB Swap: 102396 total, 0 used, 102396 free, 326248 cached



As you can see the free memory decreases. Any idea? Is it a normal behaviour?



Thank a lot,


Giorgio

Yes. Linux keeps all data it has read from files (both program code and data) in memory in "buffers" until the free memory is at some point.

This makes the system faster because it does not have to read the program from SD card again when you start it a second time, as it is already in RAM. Same for datafiles it is reading.

The effect is that on any Linux system that is in use you see the free memory decreasing and the buffers increasing until some point, where it starts to discard old buffers to make room, or swap memory to the swap space. You can tune this behaviour via sysctl.

It's normal and nothing to worry about.

There is an explanation of what is happening here:

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required