From a8f35c73559b44f8080250e96ec16e5284581829 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 3 Jul 2023 11:27:13 -0400 Subject: [PATCH] no longer eagerly use tcmalloc if it's found --- CMakeLists.txt | 7 ++++--- CMakeModules/EosioTester.cmake.in | 6 ------ CMakeModules/EosioTesterBuild.cmake.in | 6 ------ 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e49f000255..3a59d71074 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,9 +159,10 @@ endif() message( STATUS "Using '${EOSIO_ROOT_KEY}' as public key for 'eosio' account" ) -find_package( Gperftools QUIET ) -if( GPERFTOOLS_FOUND ) - message( STATUS "Found gperftools; compiling Leap with TCMalloc") +option(ENABLE_TCMALLOC "use tcmalloc (requires gperftools)" OFF) +if( ENABLE_TCMALLOC ) + find_package( Gperftools REQUIRED ) + message( STATUS "Compiling Leap with TCMalloc") #if doing this by the book, simply link_libraries( ${GPERFTOOLS_TCMALLOC} ) here. That will #give the performance benefits of tcmalloc but since it won't be linked last #the heap profiler & checker may not be accurate. This here is rather undocumented behavior diff --git a/CMakeModules/EosioTester.cmake.in b/CMakeModules/EosioTester.cmake.in index 297f0f0b72..54544db6e7 100644 --- a/CMakeModules/EosioTester.cmake.in +++ b/CMakeModules/EosioTester.cmake.in @@ -14,12 +14,6 @@ if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR) set(LLVM_DIR @LLVM_DIR@) endif() -find_package( Gperftools QUIET ) -if( GPERFTOOLS_FOUND ) - message( STATUS "Found gperftools; compiling tests with TCMalloc") - list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -endif() - if(NOT "@LLVM_FOUND@" STREQUAL "") find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG) llvm_map_components_to_libnames(LLVM_LIBS support core passes mcjit native DebugInfoDWARF orcjit) diff --git a/CMakeModules/EosioTesterBuild.cmake.in b/CMakeModules/EosioTesterBuild.cmake.in index f00f1020cb..2c34c7e595 100644 --- a/CMakeModules/EosioTesterBuild.cmake.in +++ b/CMakeModules/EosioTesterBuild.cmake.in @@ -12,12 +12,6 @@ if (LLVM_DIR STREQUAL "" OR NOT LLVM_DIR) set(LLVM_DIR @LLVM_DIR@) endif() -find_package( Gperftools QUIET ) -if( GPERFTOOLS_FOUND ) - message( STATUS "Found gperftools; compiling tests with TCMalloc") - list( APPEND PLATFORM_SPECIFIC_LIBS tcmalloc ) -endif() - if(NOT "@LLVM_FOUND@" STREQUAL "") find_package(LLVM @LLVM_VERSION@ EXACT REQUIRED CONFIG) llvm_map_components_to_libnames(LLVM_LIBS support core passes mcjit native DebugInfoDWARF orcjit)