Re: mmap + mprotect + malloc strange behaviour

From: David Addison
Date: Mon Jul 26 2004 - 08:19:20 EST


Kaloian Manassiev wrote:

Nevermind, I found it :)

I just found out (by reading
/usr/src/linux-2.4.20-8/Documentation/sysctl/vm.txt)
that there is a limit on the number of mappings that a
process may have and that for some reason malloc
consumes mappings.

I just increased the limit by editing the file
/proc/sys/vm/max_map_count. This works okay for my
application...

Does someone know what repercussions this could have
on the "normal" operation of the system?

Cheers,
Kaloian.




The glibc malloc heap switches to using mmap()/munmap() for large allocations (>=128kbytes ?). This behaviour can be turned off by setting;

export MALLOC_TRIM_THRESHOLD_=-1
export MALLOC_MMAP_MAX_=0

See also the mallopt() library call.


Cheers
Addy.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/