Can't malloc all free physical memory, CommitLimit too low
Hi all. I'm writing some code to make a custom Ubuntu 8.04 Live CD and the code will write the character "x" to all free physical memory. In a shell script, I turn off swapping (swapoff), turn off overcommit (echo 2 > /proc/sys/vm/overcommit_memory), drop_cache, check MemFree in /proc/meminfo and pass the value to a simple C program that malloc's a buffer with the size of that value. But I'm unable to allocate that amount because I think my CommitLimit shown in /proc/meminfo is 700mb out of the 1.4gb MemFree (1.5gb MemTotal). In the C code, the malloc returns a null pointer when I pass it anything greater than the value of CommitLimit, which is consistent with what I think is causing the null pointer.
Is there a way to increase the CommitLimit so I can allocate every bit of the free space? Again the script and C code is being run from a LiveCD environment, so there is no physical hard disk.
Last edited by FEWP; 07-23-2009 at 12:41 AM.
|