Only disable munmap(2) by default on 64-bit Linux.

This reduces the likelihood of address space exhaustion on 32-bit
systems.

This resolves #350.
This commit is contained in:
Jason Evans 2017-04-17 15:54:53 -07:00
parent c43a83d225
commit a01f993077
2 changed files with 11 additions and 5 deletions

View File

@ -161,9 +161,11 @@ any of the following arguments (not a definitive list) to 'configure':
--disable-munmap --disable-munmap
Disable virtual memory deallocation via munmap(2); instead keep track of Disable virtual memory deallocation via munmap(2); instead keep track of
the virtual memory for later use. munmap() is disabled by default (i.e. the virtual memory for later use. munmap() is disabled by default (i.e.
--disable-munmap is implied) on Linux, which has a quirk in its virtual --disable-munmap is implied) on [64-bit] Linux, which has a quirk in its
memory allocation algorithm that causes semi-permanent VM map holes under virtual memory allocation algorithm that causes semi-permanent VM map holes
normal jemalloc operation. under normal jemalloc operation. Although munmap() causes issues on 32-bit
Linux as well, it is not disabled by default due to the practical
possibility of address space exhaustion.
--disable-fill --disable-fill
Disable support for junk/zero filling of memory. See the "opt.junk" and Disable support for junk/zero filling of memory. See the "opt.junk" and

View File

@ -557,7 +557,9 @@ case "${host}" in
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
AC_DEFINE([JEMALLOC_C11_ATOMICS]) AC_DEFINE([JEMALLOC_C11_ATOMICS])
force_tls="0" force_tls="0"
if "${LG_SIZEOF_PTR}" = "3"; then
default_munmap="0" default_munmap="0"
fi
;; ;;
*-*-linux* | *-*-kfreebsd*) *-*-linux* | *-*-kfreebsd*)
dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE. dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
@ -568,7 +570,9 @@ case "${host}" in
AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ]) AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
AC_DEFINE([JEMALLOC_THREADED_INIT], [ ]) AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ]) AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
if "${LG_SIZEOF_PTR}" = "3"; then
default_munmap="0" default_munmap="0"
fi
;; ;;
*-*-netbsd*) *-*-netbsd*)
AC_MSG_CHECKING([ABI]) AC_MSG_CHECKING([ABI])