Question

Why is mmap buffer allocation activated by default on cygwin, freebsd and irix6-5 but not on linux?

See USE_MMAP_FOR_BUFFERS in emacs/src/config.h. and use_mmap_for_buffers in emacs/configure.in.

Isn't mmap based access superior to normal buffer allocation?

Was it helpful?

Solution

The default glibc malloc() uses mmap for large allocations; From the malloc(3) manpage. "When allocating blocks of memory larger than MMAP_THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2). MMAP_THRESHOLD is 128 kB by default, but is adjustable using mallopt(3)."

Perhaps switching to mmap on those other platforms is to work around poor malloc() implementations that don't do it themselves?

OTHER TIPS

mmap() allocation is easier to realize in a threadsafe fashion, but brk() allocation is about 10% slower on Linux. See this question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top