This command is very useful to free buffers when you face lack of memory issue. Free memory can be seen from the output of common linux command “free”:
[root@leaseweb ~]# free total used free shared buffers cached Mem: 1033972 987192 46780 0 159204 309176 -/+ buffers/cache: 518812 515160 Swap: 4192956 68 4192888
Here we can see that free memory calculation formula is:
Real free memory = free + buffers + cached
To clean up buffers and cached memory, use defrag_mem:
[root@leaseweb ~]# gcc -o defrag_mem defrag_mem.c [root@leaseweb ~]# ./defrag_mem 500M [root@leaseweb ~]# free total used free shared buffers cached Mem: 1033972 482504 551468 0 612 7760 -/+ buffers/cache: 474132 559840 Swap: 4192956 112964 4079992
Defrag_mem is available here:
http://admon.org/uploads/howto/defrag_mem.c
This document is forwarded from http://os-drive.com here with some tiny modifications. Zhigang is the creator for defrag_mem.c
Related posts:











[...] a former post, we know that with the help of defrag_mem we can clean up buffers / cached memory to gain more real “free” memory. Defrag_mem [...]
[...] a former post, we know that with the help of defrag_mem we can clean up buffers / cached memory to gain more real “free” memory. Defrag_mem [...]
Great site, I have added this page to my social bookmarks
Nice!, discovered your blog on Ask.Glad I finally tried it out. Unsure if its my Safari browser,but sometimes when I visit your site, the fonts are really tiny? However, love your page and will return.See Ya