[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Realloc is blocking execution



On Wed, 14 Oct 2009, George Danchev wrote:

Hm, I guess that the library functions are just fine and it has something to do
with the kernel performing memory overcommitment by default. You can prevent
that by (from the tail of realloc(3) man page):

echo 2 > /proc/sys/vm/overcommit_memory

and see if that makes any difference.
Rf. see overcommit_memory in $linux_source/Documentation/sysctl/vm.txt

Don't forget to look at the "vm.overcommit_ratio" sysctl. Perhaps I'm misunderstanding it, but on my workstation with 4G physical RAM and no swap, I set it to 99, leading to

total virtual address space on the system
    <= swapspace + physmem * (overcommit_ratio / 100)
    =  0         + 4096M   * 99%

I think 4096M * 1% ~= 41M should be enough for the "hard" needs of the kernel, and all other address space (backed by physical RAM) should be available to processes.

That, or I don't get it at all.

Cheers,
lacos

[0] http://linux-mm.org/OverCommitAccounting
[1] http://www.linuxinsight.com/proc_sys_vm_overcommit_ratio.html
[2] http://linux.die.net/man/5/proc


Reply to: