Skip to content

Commit

Permalink
only use tcmalloc_minimal
Browse files Browse the repository at this point in the history
  • Loading branch information
emjotde committed Sep 22, 2022
1 parent 7d2045a commit cfc33f5
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,21 @@ if(USE_STATIC_LIBS)
endif()

###############################################################################
# Find Tcmalloc
# Find Tcmalloc_minimal
# re-used from sentencepiece
if(NOT WIN32)
find_package(Tcmalloc)
if(Tcmalloc_FOUND)
include_directories(${Tcmalloc_INCLUDE_DIR})
if(USE_STATIC_LIBS)
find_library(TCMALLOC_LIB NAMES libtcmalloc_minimal.a)
else()
find_library(TCMALLOC_LIB NAMES tcmalloc_minimal)
endif()
if (TCMALLOC_LIB)
message(STATUS "Found TCMalloc: ${TCMALLOC_LIB}")
set(EXT_LIBS ${EXT_LIBS} ${Tcmalloc_LIBRARIES})
else(Tcmalloc_FOUND)
message(WARNING "Cannot find TCMalloc library. Continuing.")
endif(Tcmalloc_FOUND)
add_definitions(-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free)
else()
message(STATUS "Not Found TCMalloc: ${TCMALLOC_LIB}")
endif()
endif()

###############################################################################
Expand Down

0 comments on commit cfc33f5

Please sign in to comment.