Skip to content

Commit

Permalink
Disable 3rd party allocators for sanitizer builds (#8858)
Browse files Browse the repository at this point in the history
close #8859
  • Loading branch information
zanmato1984 authored Mar 21, 2024
1 parent 4f268df commit 9bce377
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ message (STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")

# ASan - build type with address sanitizer
# UBSan - build type with undefined behaviour sanitizer
# TSan is not supported due to false positive errors in libstdc++ and necessity to rebuild libstdc++ with TSan
set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan" CACHE STRING "" FORCE)
# TSan - build type with thread sanitizer
set (CMAKE_CONFIGURATION_TYPES "RelWithDebInfo;Debug;Release;MinSizeRel;ASan;UBSan;TSan" CACHE STRING "" FORCE)

if (NOT MSVC)
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wall") # -Werror is also added inside directories with our own code.
Expand Down
5 changes: 5 additions & 0 deletions libs/libcommon/cmake/find_jemalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ option (ENABLE_JEMALLOC "Set to TRUE to use jemalloc" ON)
option (ENABLE_JEMALLOC_PROF "Set to ON to enable jemalloc profiling" OFF)
option (USE_INTERNAL_JEMALLOC_LIBRARY "Set to FALSE to use system jemalloc library instead of bundled" ${NOT_UNBUNDLED})

if (ENABLE_JEMALLOC AND (CMAKE_BUILD_TYPE_UC STREQUAL "ASAN" OR CMAKE_BUILD_TYPE_UC STREQUAL "UBSAN" OR CMAKE_BUILD_TYPE_UC STREQUAL "TSAN"))
message (WARNING "ENABLE_JEMALLOC is set to OFF implicitly: jemalloc doesn't work with ${CMAKE_BUILD_TYPE_UC}")
set (ENABLE_JEMALLOC OFF)
endif ()

if (ENABLE_JEMALLOC)
if (USE_INTERNAL_JEMALLOC_LIBRARY)
set (JEMALLOC_LIBRARIES "jemalloc")
Expand Down
5 changes: 5 additions & 0 deletions libs/libcommon/cmake/find_mimalloc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

option (ENABLE_MIMALLOC "Set to ON to use mimalloc" OFF)

if (ENABLE_MIMALLOC AND (CMAKE_BUILD_TYPE_UC STREQUAL "ASAN" OR CMAKE_BUILD_TYPE_UC STREQUAL "UBSAN" OR CMAKE_BUILD_TYPE_UC STREQUAL "TSAN"))
message (WARNING "ENABLE_MIMALLOC is set to OFF implicitly: mimalloc doesn't work with ${CMAKE_BUILD_TYPE_UC}")
set (ENABLE_MIMALLOC OFF)
endif ()

if (ENABLE_MIMALLOC)
set (MIMALLOC_LIBRARIES "mimalloc-obj")
set (USE_MIMALLOC 1)
Expand Down

0 comments on commit 9bce377

Please sign in to comment.