My laptop is Thinkpad x220, 4G ram, harddisk is 7200rpm, installed with Ubuntu 12.04, using Unity desktop.
When I open eclipse and chrome, they eat about 2G memory. Here is the free -m
result:
total used free shared buffers cached
Mem: 3841 3301 540 0 10 956
-/+ buffers/cache: 2334 1507
Swap: 8187 306 7881
And the top
result:
Mem: 3934188k total, 3540508k used, 393680k free, 45680k buffers
Swap: 8384508k total, 313512k used, 8070996k free, 1078888k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5552 martin 20 0 4249m 388m 6560 S 0 10.1 2:46.28 java
3369 martin 20 0 2548m 182m 32m R 1 4.7 29:19.64 chrome
3406 martin 20 0 1000m 155m 16m S 0 4.1 4:18.97 chrome
2736 martin 20 0 1582m 106m 29m S 1 2.8 13:10.27 compiz
3704 martin 20 0 945m 85m 8396 S 0 2.2 0:15.60 chrome
11047 martin 20 0 926m 82m 23m S 0 2.2 0:06.52 chrome
11443 martin 20 0 915m 72m 21m S 0 1.9 0:46.08 chrome
4280 martin 20 0 822m 66m 12m S 4 1.7 14:59.41 chrome
After some periods about 10 minutes, I have only 100M+ memory available, then the system starts to swap memory to disk, that causes my computer freeze totally, it would recover after the swap finished.
I already have vm.swappiness = 10
I've searched google, and some article said that when memory is not enough, the system will free the cache, and use it as memory. But it seems to me that the cache is never freed. When the system lacks of memory (But actually I have enough memory, some memory is just used for cache), it will not use cache, instead, it swap the memory directly to disk, that causes freeze.
How can I avoid this?
Decreasing the cached memory?
Eclipse, MySQL Server, 4 tabs in Chrome, Skype and Tomcat with GWT application
only about 300 MB remain when I runfree -m
. When I start to rebuild GWT application (this takes up to 1 GB of RAM when there is enough RAM) system freezes (no mouse moving etc) and doesn't recover - I simply have to restart my laptop. When, however, I free enough RAM, GWT app rebuild passes fine. @David could you please advise how can I investigate the problem? Thanks in advance