mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
add documentation for tracking tools; rename with prefix MI_TRACK_tool
This commit is contained in:
parent
64fb009695
commit
2e6ab0f230
7 changed files with 104 additions and 52 deletions
|
@ -10,8 +10,8 @@ option(MI_PADDING "Enable padding to detect heap block overflow (alway
|
|||
option(MI_OVERRIDE "Override the standard malloc interface (e.g. define entry points for malloc() etc)" ON)
|
||||
option(MI_XMALLOC "Enable abort() call on memory allocation failure by default" OFF)
|
||||
option(MI_SHOW_ERRORS "Show error and warning messages by default (only enabled by default in DEBUG mode)" OFF)
|
||||
option(MI_VALGRIND "Compile with Valgrind support (adds a small overhead)" OFF)
|
||||
option(MI_ASAN "Compile with address sanitizer support (adds a small overhead)" OFF)
|
||||
option(MI_TRACK_VALGRIND "Compile with Valgrind support (adds a small overhead)" OFF)
|
||||
option(MI_TRACK_ASAN "Compile with address sanitizer support (adds a small overhead)" OFF)
|
||||
option(MI_USE_CXX "Use the C++ compiler to compile the library (instead of the C compiler)" OFF)
|
||||
option(MI_SEE_ASM "Generate assembly files" OFF)
|
||||
option(MI_OSX_INTERPOSE "Use interpose to override standard malloc on macOS" ON)
|
||||
|
@ -25,7 +25,7 @@ option(MI_BUILD_TESTS "Build test executables" ON)
|
|||
option(MI_DEBUG_TSAN "Build with thread sanitizer (needs clang)" OFF)
|
||||
option(MI_DEBUG_UBSAN "Build with undefined-behavior sanitizer (needs clang++)" OFF)
|
||||
option(MI_SKIP_COLLECT_ON_EXIT, "Skip collecting memory on program exit" OFF)
|
||||
option(MI_NO_PADDING "Force no use of padding even in DEBUG mode ets." OFF)
|
||||
option(MI_NO_PADDING "Force no use of padding even in DEBUG mode etc." OFF)
|
||||
|
||||
# deprecated options
|
||||
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
||||
|
@ -125,42 +125,39 @@ endif()
|
|||
|
||||
if(MI_SECURE)
|
||||
message(STATUS "Set full secure build (MI_SECURE=ON)")
|
||||
list(APPEND mi_defines MI_SECURE=4)
|
||||
#if (MI_VALGRIND)
|
||||
# message(WARNING "Secure mode is a bit weakened when compiling with Valgrind support as buffer overflow detection is no longer byte-precise (if running without valgrind)")
|
||||
#endif()
|
||||
list(APPEND mi_defines MI_SECURE=4)
|
||||
endif()
|
||||
|
||||
if(MI_VALGRIND)
|
||||
if(MI_TRACK_VALGRIND)
|
||||
CHECK_INCLUDE_FILES("valgrind/valgrind.h;valgrind/memcheck.h" MI_HAS_VALGRINDH)
|
||||
if (NOT MI_HAS_VALGRINDH)
|
||||
set(MI_VALGRIND OFF)
|
||||
set(MI_TRACK_VALGRIND OFF)
|
||||
message(WARNING "Cannot find the 'valgrind/valgrind.h' and 'valgrind/memcheck.h' -- install valgrind first")
|
||||
message(STATUS "Compile **without** Valgrind support (MI_VALGRIND=OFF)")
|
||||
message(STATUS "Compile **without** Valgrind support (MI_TRACK_VALGRIND=OFF)")
|
||||
else()
|
||||
message(STATUS "Compile with Valgrind support (MI_VALGRIND=ON)")
|
||||
list(APPEND mi_defines MI_VALGRIND=1)
|
||||
message(STATUS "Compile with Valgrind support (MI_TRACK_VALGRIND=ON)")
|
||||
list(APPEND mi_defines MI_TRACK_VALGRIND=1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MI_ASAN)
|
||||
if(MI_TRACK_ASAN)
|
||||
if (APPLE AND MI_OVERRIDE)
|
||||
set(MI_ASAN OFF)
|
||||
message(WARNING "Cannot enable address sanitizer support on macOS if MI_OVERRIDE is ON (MI_ASAN=OFF)")
|
||||
set(MI_TRACK_ASAN OFF)
|
||||
message(WARNING "Cannot enable address sanitizer support on macOS if MI_OVERRIDE is ON (MI_TRACK_ASAN=OFF)")
|
||||
endif()
|
||||
if (MI_VALGRIND)
|
||||
set(MI_ASAN OFF)
|
||||
message(WARNING "Cannot enable address sanitizer support with also Valgrind support enabled (MI_ASAN=OFF)")
|
||||
if (MI_TRACK_VALGRIND)
|
||||
set(MI_TRACK_ASAN OFF)
|
||||
message(WARNING "Cannot enable address sanitizer support with also Valgrind support enabled (MI_TRACK_ASAN=OFF)")
|
||||
endif()
|
||||
if(MI_ASAN)
|
||||
if(MI_TRACK_ASAN)
|
||||
CHECK_INCLUDE_FILES("sanitizer/asan_interface.h" MI_HAS_ASANH)
|
||||
if (NOT MI_HAS_ASANH)
|
||||
set(MI_ASAN OFF)
|
||||
set(MI_TRACK_ASAN OFF)
|
||||
message(WARNING "Cannot find the 'sanitizer/asan_interface.h' -- install address sanitizer support first")
|
||||
message(STATUS "Compile **without** address sanitizer support (MI_ASAN=OFF)")
|
||||
message(STATUS "Compile **without** address sanitizer support (MI_TRACK_ASAN=OFF)")
|
||||
else()
|
||||
message(STATUS "Compile with address sanitizer support (MI_ASAN=ON)")
|
||||
list(APPEND mi_defines MI_ASAN=1)
|
||||
message(STATUS "Compile with address sanitizer support (MI_TRACK_ASAN=ON)")
|
||||
list(APPEND mi_defines MI_TRACK_ASAN=1)
|
||||
list(APPEND mi_cflags -fsanitize=address)
|
||||
list(APPEND mi_libraries -fsanitize=address)
|
||||
endif()
|
||||
|
@ -327,10 +324,10 @@ set(mi_basename "mimalloc")
|
|||
if(MI_SECURE)
|
||||
set(mi_basename "${mi_basename}-secure")
|
||||
endif()
|
||||
if(MI_VALGRIND)
|
||||
if(MI_TRACK_VALGRIND)
|
||||
set(mi_basename "${mi_basename}-valgrind")
|
||||
endif()
|
||||
if(MI_ASAN)
|
||||
if(MI_TRACK_ASAN)
|
||||
set(mi_basename "${mi_basename}-asan")
|
||||
endif()
|
||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LC)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue