Skip to content
Snippets Groups Projects
Commit cce7c5c5 authored by Danilo Piparo's avatar Danilo Piparo
Browse files

Add -Djemalloc option

now it is possible to use both tcmalloc and jemalloc allocators within
ROOT w/o the need of preloading. This can be an asset also in the context
of a multithreaded environment.
parent 9e4f948f
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,12 @@ if (TCMALLOC_FOUND) ...@@ -52,6 +52,12 @@ if (TCMALLOC_FOUND)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ltcmalloc") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ltcmalloc")
endif() endif()
#---Here we add jemalloc to the linker flags if needed------------------------------------------
if (JEMALLOC_FOUND)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljemalloc")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ljemalloc")
endif()
#---Populate the configure arguments returned by 'root-config --config'------------------------- #---Populate the configure arguments returned by 'root-config --config'-------------------------
get_cmake_property(variables CACHE_VARIABLES) get_cmake_property(variables CACHE_VARIABLES)
foreach(var ${variables}) foreach(var ${variables})
......
...@@ -131,6 +131,7 @@ ROOT_BUILD_OPTION(globus OFF "Globus authentication support, requires Globus too ...@@ -131,6 +131,7 @@ ROOT_BUILD_OPTION(globus OFF "Globus authentication support, requires Globus too
ROOT_BUILD_OPTION(gsl_shared OFF "Enable linking against shared libraries for GSL (default no)") ROOT_BUILD_OPTION(gsl_shared OFF "Enable linking against shared libraries for GSL (default no)")
ROOT_BUILD_OPTION(hdfs ON "HDFS support; requires libhdfs from HDFS >= 0.19.1") ROOT_BUILD_OPTION(hdfs ON "HDFS support; requires libhdfs from HDFS >= 0.19.1")
ROOT_BUILD_OPTION(http ${http_defvalue} "HTTP Server support") ROOT_BUILD_OPTION(http ${http_defvalue} "HTTP Server support")
ROOT_BUILD_OPTION(jemalloc OFF "Using the jemalloc allocator")
ROOT_BUILD_OPTION(krb5 ON "Kerberos5 support, requires Kerberos libs") ROOT_BUILD_OPTION(krb5 ON "Kerberos5 support, requires Kerberos libs")
ROOT_BUILD_OPTION(ldap ON "LDAP support, requires (Open)LDAP libs") ROOT_BUILD_OPTION(ldap ON "LDAP support, requires (Open)LDAP libs")
ROOT_BUILD_OPTION(mathmore ON "Build the new libMathMore extended math library, requires GSL (vers. >= 1.8)") ROOT_BUILD_OPTION(mathmore ON "Build the new libMathMore extended math library, requires GSL (vers. >= 1.8)")
......
...@@ -853,6 +853,19 @@ if (tcmalloc) ...@@ -853,6 +853,19 @@ if (tcmalloc)
endif() endif()
endif() endif()
#---Check for JEMalloc---------------------------------------------------------------
if (jemalloc)
if (tcmalloc)
message(FATAL_ERROR "Both tcmalloc and jemalloc were selected: this is an inconsistent setup.")
endif()
message(STATUS "Looking for jemalloc")
find_package(jemalloc)
if(NOT JEMALLOC_FOUND)
message(STATUS "JEMalloc not found.")
endif()
endif()
#---Report non implemented options--------------------------------------------------- #---Report non implemented options---------------------------------------------------
foreach(opt afs clarens glite pch peac sapdb srp geocad) foreach(opt afs clarens glite pch peac sapdb srp geocad)
if(${opt}) if(${opt})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment