diff --git a/be/src/http/action/jeprofile_actions.cpp b/be/src/http/action/jeprofile_actions.cpp index f805d61d5b0b87..2f4a2ff95e493b 100644 --- a/be/src/http/action/jeprofile_actions.cpp +++ b/be/src/http/action/jeprofile_actions.cpp @@ -61,7 +61,7 @@ void JeHeapAction::handle(HttpRequest* req) { << "." << rand() << ".heap"; const std::string& tmp_file_name_str = tmp_jeprof_file_name.str(); const char* file_name_ptr = tmp_file_name_str.c_str(); - int result = jemallctl("prof.dump", nullptr, nullptr, &file_name_ptr, sizeof(const char*)); + int result = mallctl("prof.dump", nullptr, nullptr, &file_name_ptr, sizeof(const char*)); std::stringstream response; if (result == 0) { response << "Jemalloc heap dump success, dump file path: " << tmp_jeprof_file_name.str() diff --git a/be/src/http/default_path_handlers.cpp b/be/src/http/default_path_handlers.cpp index 2ece1e3fdcd20a..2efa387a87f071 100644 --- a/be/src/http/default_path_handlers.cpp +++ b/be/src/http/default_path_handlers.cpp @@ -115,7 +115,7 @@ void mem_usage_handler(const WebPageHandler::ArgumentMap& args, std::stringstrea auto* _opaque = static_cast(opaque); _opaque->append(buf); }; - jemalloc_stats_print(write_cb, &tmp, "a"); + malloc_stats_print(write_cb, &tmp, "a"); boost::replace_all(tmp, "\n", "
"); (*output) << tmp << ""; #else diff --git a/be/src/runtime/CMakeLists.txt b/be/src/runtime/CMakeLists.txt index a0b3b799a764cb..ab380f9711f1ac 100644 --- a/be/src/runtime/CMakeLists.txt +++ b/be/src/runtime/CMakeLists.txt @@ -25,9 +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) - list(REMOVE_ITEM RUNTIME_FILES ${CMAKE_CURRENT_SOURCE_DIR}/memory/jemalloc_hook.cpp) -endif() +list(REMOVE_ITEM RUNTIME_FILES ${CMAKE_CURRENT_SOURCE_DIR}/memory/jemalloc_hook.cpp) add_library(Runtime STATIC ${RUNTIME_FILES} diff --git a/be/src/util/mem_info.cpp b/be/src/util/mem_info.cpp index b1bcfdcc56b430..77c669aea40e83 100644 --- a/be/src/util/mem_info.cpp +++ b/be/src/util/mem_info.cpp @@ -101,7 +101,7 @@ void MemInfo::refresh_allocator_mem() { // the current epoch number, which might be useful to log as a sanity check. uint64_t epoch = 0; size_t sz = sizeof(epoch); - jemallctl("epoch", &epoch, &sz, &epoch, sz); + mallctl("epoch", &epoch, &sz, &epoch, sz); // Number of extents of the given type in this arena in the bucket corresponding to page size index. // Large size class starts at 16384, the extents have three sizes before 16384: 4096, 8192, and 12288, so + 3 diff --git a/be/src/util/mem_info.h b/be/src/util/mem_info.h index 10d2d086801540..0dd37f74e80cb5 100644 --- a/be/src/util/mem_info.h +++ b/be/src/util/mem_info.h @@ -103,7 +103,7 @@ class MemInfo { #ifdef USE_JEMALLOC size_t value = 0; size_t sz = sizeof(value); - if (jemallctl(name.c_str(), &value, &sz, nullptr, 0) == 0) { + if (mallctl(name.c_str(), &value, &sz, nullptr, 0) == 0) { return value; } #endif @@ -114,7 +114,7 @@ class MemInfo { #ifdef USE_JEMALLOC unsigned value = 0; size_t sz = sizeof(value); - if (jemallctl(name.c_str(), &value, &sz, nullptr, 0) == 0) { + if (mallctl(name.c_str(), &value, &sz, nullptr, 0) == 0) { return value; } #endif @@ -146,7 +146,7 @@ class MemInfo { if (config::enable_je_purge_dirty_pages) { try { // Purge all unused dirty pages for arena , or for all arenas if equals MALLCTL_ARENAS_ALL. - jemallctl(fmt::format("arena.{}.purge", MALLCTL_ARENAS_ALL).c_str(), nullptr, + mallctl(fmt::format("arena.{}.purge", MALLCTL_ARENAS_ALL).c_str(), nullptr, nullptr, nullptr, 0); } catch (...) { LOG(WARNING) << "Purge all unused dirty pages for all arenas failed"; diff --git a/be/src/vec/common/allocator.h b/be/src/vec/common/allocator.h index b05128bc6933cc..a0ab9c8c0a8207 100644 --- a/be/src/vec/common/allocator.h +++ b/be/src/vec/common/allocator.h @@ -109,7 +109,7 @@ class DefaultMemoryAllocator { static void release_unused() { #if defined(USE_JEMALLOC) - jemallctl(fmt::format("arena.{}.purge", MALLCTL_ARENAS_ALL).c_str(), NULL, NULL, NULL, 0); + mallctl(fmt::format("arena.{}.purge", MALLCTL_ARENAS_ALL).c_str(), NULL, NULL, NULL, 0); #endif // defined(USE_JEMALLOC) } }; diff --git a/build.sh b/build.sh index 6f3ddfa236fb10..b39000f9b6c03e 100755 --- a/build.sh +++ b/build.sh @@ -366,20 +366,6 @@ if [[ "${BUILD_TYPE_LOWWER}" == "asan" ]]; then elif [[ -z "${USE_JEMALLOC}" ]]; then USE_JEMALLOC='ON' fi -if [[ -f "${TP_INCLUDE_DIR}/jemalloc/jemalloc_doris_with_prefix.h" ]]; then - # compatible with old thirdparty - rm -rf "${TP_INCLUDE_DIR}/jemalloc/jemalloc.h" - rm -rf "${TP_LIB_DIR}/libjemalloc_doris.a" - rm -rf "${TP_LIB_DIR}/libjemalloc_doris_pic.a" - rm -rf "${TP_INCLUDE_DIR}/rocksdb" - rm -rf "${TP_LIB_DIR}/librocksdb.a" - - mv "${TP_INCLUDE_DIR}/jemalloc/jemalloc_doris_with_prefix.h" "${TP_INCLUDE_DIR}/jemalloc/jemalloc.h" - mv "${TP_LIB_DIR}/libjemalloc_doris_with_prefix.a" "${TP_LIB_DIR}/libjemalloc_doris.a" - mv "${TP_LIB_DIR}/libjemalloc_doris_with_prefix_pic.a" "${TP_LIB_DIR}/libjemalloc_doris_pic.a" - mv "${TP_LIB_DIR}/librocksdb_jemalloc_with_prefix.a" "${TP_LIB_DIR}/librocksdb.a" - mv -f "${TP_INCLUDE_DIR}/rocksdb_jemalloc_with_prefix" "${TP_INCLUDE_DIR}/rocksdb" -fi if [[ -z "${USE_BTHREAD_SCANNER}" ]]; then USE_BTHREAD_SCANNER='OFF' fi diff --git a/cloud/src/common/CMakeLists.txt b/cloud/src/common/CMakeLists.txt index 429748909bebd9..008e8906044d51 100644 --- a/cloud/src/common/CMakeLists.txt +++ b/cloud/src/common/CMakeLists.txt @@ -15,12 +15,6 @@ set(COMMON_FILES network_util.cpp ) -if (USE_JEMALLOC) - set(COMMON_FILES ${COMMON_FILES} - jemalloc_hook.cpp - ) -endif() - add_library(Common STATIC ${COMMON_FILES} ) diff --git a/thirdparty/build-thirdparty.sh b/thirdparty/build-thirdparty.sh index f019f5f1e26bb2..a209977769c278 100755 --- a/thirdparty/build-thirdparty.sh +++ b/thirdparty/build-thirdparty.sh @@ -1529,8 +1529,10 @@ build_jemalloc_doris() { WITH_LG_PAGE='' fi + # CFLAGS="${cflags}" ../configure --prefix="${TP_INSTALL_DIR}" --with-install-suffix="_doris" "${WITH_LG_PAGE}" \ + # --with-jemalloc-prefix=je --enable-prof --disable-cxx --disable-libdl --disable-shared CFLAGS="${cflags}" ../configure --prefix="${TP_INSTALL_DIR}" --with-install-suffix="_doris" "${WITH_LG_PAGE}" \ - --with-jemalloc-prefix=je --enable-prof --disable-cxx --disable-libdl --disable-shared + --enable-prof --disable-libdl --disable-shared make -j "${PARALLEL}" make install