0
I have a linux server (Ubuntu 10.04) which has no swap space (swapon -l reports nothing, 0kb swap memory listed in /proc/meminfo). The beginning of the output of top (sorted by %mem) is reproduced below:
top - 04:18:28 up 7:31, 2 users, load average: 0.93, 0.76, 0.71
Tasks: 25 total, 2 running, 23 sleeping, 0 stopped, 0 zombie
Cpu(s): 15.0%us, 0.8%sy, 0.0%ni, 84.1%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 4195200k total, 4177028k used, 18172k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP COMMAND
30075 admin 20 0 4026m 1.4g 9648 S 31 35.7 271:03.97 2.5g java
7700 root 15 0 170m 9152 4360 S 0 0.2 0:00.96 161m apache2
7730 www-data 15 0 171m 6268 1168 S 0 0.1 0:00.00 165m apache2
7726 www-data 15 0 171m 6232 1108 S 0 0.1 0:00.01 165m apache2
9520 www-data 15 0 171m 6228 1100 S 0 0.1 0:00.00 165m apache2
My confusion is how 4 GB of memory could be used with only about 40% of the usage reported (ps agrees with these numbers). Further, I am confused how more virtual memory could be allocated than resident when there is no swap space.
As reported, there is no free memory, apt-get failed due to a bad allocation. This too confuses me, as I thought the OOM killer would have sprung into action before this could happen.
Thanks for your response, but my question was more about where my physical memory was going. Based on top, only about 1.5GB are being allocated to processes, yet all 4GB are being used. Further, 2.5GB of swap memory is being allocated to java, yet there is no swap memory in the system. – Zack Bloom – 2010-11-08T10:21:46.140
See command
slabtop
- especially if you have XFS filesystem, it can effectively use the memory in the ways it hides it from you. And, in Linux swap can be more than just the swap partition. Do you have 32 or 64 bit Ubuntu? – Janne Pikkarainen – 2010-11-08T10:28:54.663And that 1.4 GB memory use + 2.5 GB of swap use for you Java process sums nicely up to 3.9 gigabytes, which would be all of your RAM. So, since there's not actual swap space available, your system most likely uses RAM for "swap". I guess your Java application has lots of inactive pages the kernel would like to swap out somewhere. – Janne Pikkarainen – 2010-11-08T10:31:49.697
Ah, I didn't consider that it might consider data it would swap as in the swap space. Thanks for your help. – Zack Bloom – 2010-11-08T12:16:07.513