diff --git a/be/CMakeLists.txt b/be/CMakeLists.txt index f5d99c69962dee..2082aa8def8b23 100644 --- a/be/CMakeLists.txt +++ b/be/CMakeLists.txt @@ -72,6 +72,7 @@ option(USE_LIBCPP "Use libc++" OFF) option(USE_MEM_TRACKER, "Use memory tracker" ON) option(USE_UNWIND "Use libunwind" ON) option(USE_JEMALLOC "Use jemalloc" ON) +option(USE_JEMALLOC_HOOK "Use jemalloc hook" ON) if (OS_MACOSX) set(GLIBC_COMPATIBILITY OFF) set(USE_LIBCPP ON) @@ -87,6 +88,7 @@ message(STATUS "GLIBC_COMPATIBILITY is ${GLIBC_COMPATIBILITY}") message(STATUS "USE_LIBCPP is ${USE_LIBCPP}") message(STATUS "USE_MEM_TRACKER is ${USE_MEM_TRACKER}") message(STATUS "USE_JEMALLOC is ${USE_JEMALLOC}") +message(STATUS "USE_JEMALLOC_HOOK is ${USE_JEMALLOC_HOOK}") message(STATUS "USE_UNWIND is ${USE_UNWIND}") message(STATUS "ENABLE_PCH is ${ENABLE_PCH}") @@ -341,6 +343,9 @@ endif() if (USE_JEMALLOC) add_compile_options(-DUSE_JEMALLOC) endif() +if (USE_JEMALLOC_HOOK) + add_definitions(-DUSE_JEMALLOC_HOOK) +endif() # Compile with libunwind if (USE_UNWIND) diff --git a/be/src/runtime/CMakeLists.txt b/be/src/runtime/CMakeLists.txt index a0b3b799a764cb..3bfec93edfc083 100644 --- a/be/src/runtime/CMakeLists.txt +++ b/be/src/runtime/CMakeLists.txt @@ -25,7 +25,7 @@ set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/runtime") file(GLOB_RECURSE RUNTIME_FILES CONFIGURE_DEPENDS *.cpp *.cc) -if (NOT USE_JEMALLOC OR NOT USE_MEM_TRACKER) +if (NOT USE_JEMALLOC OR NOT USE_MEM_TRACKER OR NOT USE_JEMALLOC_HOOK) list(REMOVE_ITEM RUNTIME_FILES ${CMAKE_CURRENT_SOURCE_DIR}/memory/jemalloc_hook.cpp) endif() diff --git a/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h b/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h index 03c1639c45aa09..5d627782f25e4d 100644 --- a/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h +++ b/be/src/vec/aggregate_functions/aggregate_function_group_array_intersect.h @@ -256,11 +256,11 @@ class AggregateFunctionGroupArrayIntersect read_pod_binary(is_set_contains_null, buf); data.value->change_contains_null_value(is_set_contains_null); read_pod_binary(data.init, buf); - size_t size; + UInt64 size; read_var_uint(size, buf); T element; - for (size_t i = 0; i < size; ++i) { + for (UInt64 i = 0; i < size; ++i) { read_int_binary(element, buf); data.value->insert(static_cast(&element)); } @@ -484,11 +484,11 @@ class AggregateFunctionGroupArrayIntersectGeneric read_pod_binary(is_set_contains_null, buf); data.value->change_contains_null_value(is_set_contains_null); read_pod_binary(data.init, buf); - size_t size; + UInt64 size; read_var_uint(size, buf); StringRef element; - for (size_t i = 0; i < size; ++i) { + for (UInt64 i = 0; i < size; ++i) { element = read_string_binary_into(*arena, buf); data.value->insert((void*)element.data, element.size); } diff --git a/build.sh b/build.sh index efa808652b609c..99de71173ac64b 100755 --- a/build.sh +++ b/build.sh @@ -346,6 +346,9 @@ fi if [[ -z "${USE_JEMALLOC}" ]]; then USE_JEMALLOC='ON' fi +if [[ -z "${USE_JEMALLOC_HOOK}" ]]; then + USE_JEMALLOC_HOOK='OFF' +fi if [[ -z "${USE_BTHREAD_SCANNER}" ]]; then USE_BTHREAD_SCANNER='OFF' fi @@ -446,6 +449,7 @@ echo "Get params: STRIP_DEBUG_INFO -- ${STRIP_DEBUG_INFO} USE_MEM_TRACKER -- ${USE_MEM_TRACKER} USE_JEMALLOC -- ${USE_JEMALLOC} + USE_JEMALLOC_HOOK -- ${USE_JEMALLOC_HOOK} USE_BTHREAD_SCANNER -- ${USE_BTHREAD_SCANNER} ENABLE_STACKTRACE -- ${ENABLE_STACKTRACE} DENABLE_CLANG_COVERAGE -- ${DENABLE_CLANG_COVERAGE} @@ -544,6 +548,7 @@ if [[ "${BUILD_BE}" -eq 1 ]]; then -DENABLE_PCH="${ENABLE_PCH}" \ -DUSE_MEM_TRACKER="${USE_MEM_TRACKER}" \ -DUSE_JEMALLOC="${USE_JEMALLOC}" \ + -DUSE_JEMALLOC_HOOK="${USE_JEMALLOC_HOOK}" \ -DENABLE_STACKTRACE="${ENABLE_STACKTRACE}" \ -DUSE_AVX2="${USE_AVX2}" \ -DGLIBC_COMPATIBILITY="${GLIBC_COMPATIBILITY}" \ diff --git a/regression-test/pipeline/performance/compile.sh b/regression-test/pipeline/performance/compile.sh index cf4320f23b163e..e0e40a717707ea 100644 --- a/regression-test/pipeline/performance/compile.sh +++ b/regression-test/pipeline/performance/compile.sh @@ -133,6 +133,7 @@ sudo docker run -i --rm \ && export EXTRA_CXX_FLAGS=-O3 \ && export USE_JEMALLOC='ON' \ && export ENABLE_PCH=OFF \ + && export USE_JEMALLOC_HOOK='OFF' \ && export CUSTOM_NPM_REGISTRY=https://registry.npmjs.org \ && bash build.sh --fe --be --clean 2>&1 | tee build.log" set +x