I have the impression that the kernel was checking against memory
overcommit since some 1.3.xx kernel version, this is from the
mm/mmap.c file, function sys_brk:
/*
* Check if we have enough memory..
*/
if (!vm_enough_memory((newbrk-oldbrk) >> PAGE_SHIFT))
goto out;
Maybe the problem is in the vm_enough_memory routine:
/*
* Check that a process has enough memory to allocate a
* new virtual mapping.
*/
static inline int vm_enough_memory(long pages)
{
/*
* stupid algorithm to decide if we have enough memory: while
* simple, it hopefully works in most obvious cases.. Easy to
* fool it, but this should catch most mistakes.
*/
long freepages;
freepages = buffermem >> PAGE_SHIFT;
freepages += page_cache_size;
freepages >>= 1;
freepages += nr_free_pages;
freepages += nr_swap_pages;
freepages -= num_physpages >> 4;
return freepages > pages;
}
In any case, an easy fix (that does not require upgrading the kernel
to a probably fixed version) is to use malloc and then do a memset on
the region. Probably cmalloc can do this.
Cheers,
Miguel.
-- miguel@roxanne.nuclecu.unam.mx The GNU Midnight Commander: http://mc.blackdown.org/mc Linux/SPARC project: http://www.geog.ubc.ca/sparclinux.html