Large data segments interact poorly with MALLOC_OPTIONS=M

Ryan Stone rysto32 at gmail.com
Thu Jun 9 19:32:18 UTC 2011


At $(WORK) I've been porting our applications from FreeBSD 6 to
FreeBSD 8.  One of our daemons tends to be a big memory hog, so we set
a data segment size of 1.5GB to accommodate it.  This ends up breaking
horribly now that malloc uses mmap to allocate memory by default.
What happens is that malloc ends up exhausting all of the address
space outside of the data segment first(with mmap) before using any of
the data segment(with sbrk).  Meanwhile, other users of mmap can only
allocate address space outside of the data segment.  This includes
pthread_create, which allocates the thread's stack directly via mmap.

Is the recommendation with jemalloc to make the data segment as small
as possible, to avoid these types of issues?


More information about the freebsd-hackers mailing list