diff options
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | doc/README.win32 | 2 | ||||
-rw-r--r-- | doc/debugging.md | 4 |
4 files changed, 13 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e79a4c05..f0d84cd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,11 @@ IF(enable_redirect_malloc) ADD_DEFINITIONS("-DGC_USE_DLOPEN_WRAP") ENDIF(enable_redirect_malloc) +OPTION(enable_munmap "Return page to the OS if empty for N collections" ON) +IF(enable_munmap) + ADD_DEFINITIONS("-DUSE_MMAP -DUSE_MUNMAP") +ENDIF(enable_munmap) + OPTION(enable_large_config "Optimize for large heap or root set" NO) IF(enable_large_config) ADD_DEFINITIONS("-DLARGE_CONFIG") @@ -204,7 +209,7 @@ ENDIF(enable_gc_assertions) OPTION(enable_checksums "Report erroneously cleared dirty bits" NO) IF(enable_checksums) - IF(enable_threads) + IF(enable_munmap OR enable_threads) MESSAGE("CHECKSUMS not compatible with USE_MUNMAP or threads") ENDIF(enable_threads) ADD_DEFINITIONS("-DCHECKSUMS") diff --git a/configure.ac b/configure.ac index e392b978..35d5a45a 100644 --- a/configure.ac +++ b/configure.ac @@ -898,9 +898,10 @@ fi AC_ARG_ENABLE(munmap, [AC_HELP_STRING([--enable-munmap=N], - [return page to the os if empty for N collections])], + [Return page to the OS if empty for N collections + (default: 6)])], MUNMAP_THRESHOLD=$enableval) -if test x$enable_munmap != x -a x$enable_munmap != xno; then +if test x$enable_munmap != xno; then AC_DEFINE([USE_MMAP], 1, [Define to use mmap instead of sbrk to expand the heap.]) AH_TEMPLATE([USE_WINALLOC], @@ -909,7 +910,7 @@ if test x$enable_munmap != x -a x$enable_munmap != xno; then AC_DEFINE([USE_MUNMAP], 1, [Define to return memory to OS with munmap calls (see doc/README.macros).]) - if test "${MUNMAP_THRESHOLD}" = "yes"; then + if test x$MUNMAP_THRESHOLD = x -o x$MUNMAP_THRESHOLD = xyes; then MUNMAP_THRESHOLD=6 fi AC_DEFINE_UNQUOTED([MUNMAP_THRESHOLD], [${MUNMAP_THRESHOLD}], @@ -928,8 +929,7 @@ AC_ARG_ENABLE(checksums, substantial performance cost; use only for debugging of the incremental collector])]) if test x$enable_checksums = xyes; then - if test x$enable_munmap != x -a x$enable_munmap != xno \ - -o x$THREADS != xnone; then + if test x$enable_munmap != xno -o x$THREADS != xnone; then AC_MSG_ERROR([CHECKSUMS not compatible with USE_MUNMAP or threads]) fi AC_DEFINE([CHECKSUMS], 1, diff --git a/doc/README.win32 b/doc/README.win32 index 938ae6e1..3ff70007 100644 --- a/doc/README.win32 +++ b/doc/README.win32 @@ -71,7 +71,7 @@ configure (this will instruct make to compile with -D GC_DLL). Parallel marker is enabled by default; it could be disabled by "--disable-parallel-mark" option. -Memory unmapping could be enabled via "--enable-munmap". +Memory unmapping could be turned off by "--disable-munmap" option. Borland Tools ------------- diff --git a/doc/debugging.md b/doc/debugging.md index b714dfb2..28626807 100644 --- a/doc/debugging.md +++ b/doc/debugging.md @@ -125,9 +125,7 @@ Unexpected heap growth can be due to one of the following: symptom is that GC_dump() shows much of the heap as black-listed. 3. Heap fragmentation. This should never result in unbounded growth, but it may account for larger heaps. This is most commonly caused by allocation - of large objects. On some platforms it can be reduced by building with - `-DUSE_MUNMAP`, which will cause the collector to unmap memory corresponding - to pages that have not been recently used. + of large objects. 4. Per object overhead. This is usually a relatively minor effect, but it may be worth considering. If the collector recognizes interior pointers, object sizes are increased, so that one-past-the-end pointers are correctly |