aboutsummaryrefslogtreecommitdiff
path: root/dep/jemalloc
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2017-11-29 20:14:35 +0100
committerfunjoker <funjoker109@gmail.com>2021-02-25 18:50:55 +0100
commite9e59e0861a259caaa02eb3929353b15b7a6f684 (patch)
tree6bbc6db572ad34f2894ac8f4f3f5bfd11168a94e /dep/jemalloc
parentba953eb6ac6add226b2c8150a9726053b06353cb (diff)
Dep/Jemalloc: Enable MADV_FREE if available
(cherry picked from commit 10ad43916fb67eaf59c5a676c83b36ec8506beec)
Diffstat (limited to 'dep/jemalloc')
-rw-r--r--dep/jemalloc/CMakeLists.txt8
-rw-r--r--dep/jemalloc/jemalloc_internal_defs.h.in.cmake2
2 files changed, 9 insertions, 1 deletions
diff --git a/dep/jemalloc/CMakeLists.txt b/dep/jemalloc/CMakeLists.txt
index 3e2ab40b821..33e586fe54b 100644
--- a/dep/jemalloc/CMakeLists.txt
+++ b/dep/jemalloc/CMakeLists.txt
@@ -10,6 +10,8 @@
if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM)
# We need to generate the jemalloc_def.h header based on platform-specific settings
+ CHECK_SYMBOL_EXISTS(MADV_FREE "sys/mman.h" HAVE_MADV_FREE)
+
if (PLATFORM EQUAL 32)
set(JEM_SIZEDEF 2)
set(JEM_TLSMODEL)
@@ -20,6 +22,12 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM)
set(JEM_VADDRBITS 48)
endif()
+ if (HAVE_MADV_FREE)
+ set(JEM_MADFREE_DEF "#define")
+ else()
+ set(JEM_MADFREE_DEF "#undef")
+ endif()
+
# Create the header, so we can use it
configure_file(
"${CMAKE_SOURCE_DIR}/dep/jemalloc/jemalloc_internal_defs.h.in.cmake"
diff --git a/dep/jemalloc/jemalloc_internal_defs.h.in.cmake b/dep/jemalloc/jemalloc_internal_defs.h.in.cmake
index 5af111726be..1527fa2c2fe 100644
--- a/dep/jemalloc/jemalloc_internal_defs.h.in.cmake
+++ b/dep/jemalloc/jemalloc_internal_defs.h.in.cmake
@@ -268,7 +268,7 @@
* MADV_FREE, though typically with higher
* system overhead.
*/
-/*#define JEMALLOC_PURGE_MADVISE_FREE*/
+@JEM_MADFREE_DEF@ JEMALLOC_PURGE_MADVISE_FREE
#define JEMALLOC_PURGE_MADVISE_DONTNEED
#define JEMALLOC_PURGE_MADVISE_DONTNEED_ZEROS 1