Skip to content

Instantly share code, notes, and snippets.

@batunpc
Created January 1, 2023 05:13
Show Gist options
  • Save batunpc/318f6650980265cb1754e88e923d1457 to your computer and use it in GitHub Desktop.
Save batunpc/318f6650980265cb1754e88e923d1457 to your computer and use it in GitHub Desktop.
use heapcheck with CMake
# Set the path to the GPerfTools library
find_library(GPERFTOOLS_LIBRARIES tcmalloc)
# Set the flags needed to build with heapcheck
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
# Add the heapcheck library to your target
target_link_libraries(my_target ${GPERFTOOLS_LIBRARIES})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment