Flaherty, Patrick wrote, On 07/14/2010 03:49 PM: > I did some testing a while back, and my results showed that the -/+ > buffers line seemed to be the *Minimum* amount of ram available if the > kernel purged it's buffers/cache. Sometimes more is available. > > (Roughly) The test was: > * Turn swap off > * Run free > * Run 20 instances of a test program that malloc'd 100 megs of ram > * Run free, see 2 gigs of ram + orginal amount of ram used. > * Kill N number of those programs, which should free up N*100megs > * Run free, output of -/+ did not reflect 2gigs - (N*100 megs). > > I followed up by running enough instances of the test program that I > should have run out of memory free said I had, but the programs all > started, none were killed. I ran free again got a number pretty close > to what I thought should be free. It's a fun test to play with, I assume > results vary from kernel to kernel (how aggressive the kernel is > cleaning up returned ram). > > Patrick Did your test program actually USE the 100 megs of ram? Because of "lazy allocation" or "optimistic memory allocation"*** as done by the kernel, the memory is not actually consumed until used. When I did something similar, I simply wrote a char to each byte of memory(there are faster ways, but I wanted simple not fast) after each allocation. You might have done this but I did not interpret your message to indicate that. ***I don't remember which is the correct term to search. but this link has two sets of source to show the difference: http://linuxdevcenter.com/pub/a/linux/2006/11/30/linux-out-of-memory.html -- Todd Denniston Crane Division, Naval Surface Warfare Center (NSWC Crane) Harnessing the Power of Technology for the Warfighter _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos