summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author杨威 <[email protected]>2023-07-04 15:34:06 +0800
committer杨威 <[email protected]>2023-07-04 15:34:06 +0800
commitb2bec2e92c55d57c7950dae580071ae29bbd4818 (patch)
tree100858e0a3182e404a3616e9ad7dc7206f18d567
parent9e0d795c5daf8632c280dd71620874c1c3e6c70e (diff)
🔧 build(MEMPOOL dlopen): 使用TCMALLOC和MIMALLOC时,dlopen不使用DEEPBIND选项
-rw-r--r--CMakeLists.txt7
-rw-r--r--src/plugin/src/plugin.c12
2 files changed, 17 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4112741..971f2d9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,10 +130,17 @@ message(STATUS "MEM_POOL='${MEM_POOL}'")
if(MEM_POOL STREQUAL "TCMALLOC_MINI")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltcmalloc_minimal -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
+ add_definitions(-DUSE_TCMALLOC=1)
elseif(MEM_POOL STREQUAL "TCMALLOC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltcmalloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
+ add_definitions(-DUSE_TCMALLOC=1)
elseif(MEM_POOL STREQUAL "JEMALLOC")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ljemalloc -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
+ add_definitions(-DUSE_JEMALLOC=1)
+elseif(MEM_POOL STREQUAL "JEMALLOC_STATIC")
+ add_definitions(-DUSE_JEMALLOC=1)
+elseif(MEM_POOL STREQUAL "MIMALLOC")
+ add_definitions(-DUSE_MIMALLOC=1)
endif()
# 定义宏 LIBEVENT_ENABLED
diff --git a/src/plugin/src/plugin.c b/src/plugin/src/plugin.c
index f1f95d9..c838b5d 100644
--- a/src/plugin/src/plugin.c
+++ b/src/plugin/src/plugin.c
@@ -706,12 +706,20 @@ int process_confelem_sofilename(char* filename,int plugtype,stProtocolPlugInfo*
if((plugtype == PLUGTYPE_PLATFORM) || (plugtype == PLUGTYPE_PROTOCOL))
{
//ƽ̨��ͽ����������ű�����
- filepoint = dlopen(buf_sofilename,RTLD_NOW|RTLD_LAZY|RTLD_GLOBAL);
+ #if defined(USE_TCMALLOC) || defined(USE_MIMALLOC)
+ filepoint = dlopen(buf_sofilename,RTLD_NOW|RTLD_LAZY|RTLD_GLOBAL);
+ #else
+ filepoint = dlopen(buf_sofilename,RTLD_NOW|RTLD_LAZY|RTLD_GLOBAL|RTLD_DEEPBIND);
+ #endif
}
else
{
//ҵ��������ű����ȵ����Լ����ű�
- filepoint = dlopen(buf_sofilename,RTLD_NOW|RTLD_LAZY|RTLD_LOCAL);
+ #if defined(USE_TCMALLOC) || defined(USE_MIMALLOC)
+ filepoint = dlopen(buf_sofilename,RTLD_NOW|RTLD_LAZY|RTLD_LOCAL);
+ #else
+ filepoint = dlopen(buf_sofilename,RTLD_NOW|RTLD_LAZY|RTLD_LOCAL|RTLD_DEEPBIND);
+ #endif
}
if( filepoint == NULL )