diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -229,6 +229,13 @@ endif() if(USE_JEMALLOC_EXPERIMENTAL) + # Most of the sanitizers require their instrumented allocation functions to + # be fully functional. This is obviously the case for all the memory related + # sanitizers (asan, lsan, msan) but not only. + if(ENABLE_SANITIZERS) + message(FATAL_ERROR "The sanitizers are incompatible with jemalloc, consider disabling it with -DUSE_JEMALLOC_EXPERIMENTAL=OFF.") + endif() + find_package(Jemalloc REQUIRED) link_libraries(Jemalloc::jemalloc) endif()