diff --git a/be/src/common/config.h b/be/src/common/config.h index 0d52f5f844c988..16525caaa4424b 100644 --- a/be/src/common/config.h +++ b/be/src/common/config.h @@ -53,6 +53,8 @@ CONF_String(priority_networks, ""); CONF_mInt64(tc_use_memory_min, "10737418240"); // free memory rate.[0-100] CONF_mInt64(tc_free_memory_rate, "20"); +// tcmallc aggressive_memory_decommit +CONF_mBool(tc_enable_aggressive_memory_decommit, "false"); // Bound on the total amount of bytes allocated to thread caches. // This bound is not strict, so it is possible for the cache to go over this bound diff --git a/be/src/runtime/bufferpool/system_allocator.cc b/be/src/runtime/bufferpool/system_allocator.cc index 9a576d9488e20c..cc5f7b7a2756ed 100644 --- a/be/src/runtime/bufferpool/system_allocator.cc +++ b/be/src/runtime/bufferpool/system_allocator.cc @@ -45,14 +45,6 @@ static int64_t HUGE_PAGE_SIZE = 2LL * 1024 * 1024; SystemAllocator::SystemAllocator(int64_t min_buffer_len) : min_buffer_len_(min_buffer_len) { DCHECK(BitUtil::IsPowerOf2(min_buffer_len)); -#if !defined(ADDRESS_SANITIZER) && !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER) && \ - !defined(USE_JEMALLOC) - // Free() assumes that aggressive decommit is enabled for TCMalloc. - size_t aggressive_decommit_enabled; - MallocExtension::instance()->GetNumericProperty("tcmalloc.aggressive_memory_decommit", - &aggressive_decommit_enabled); - CHECK_EQ(true, aggressive_decommit_enabled); -#endif } Status SystemAllocator::Allocate(int64_t len, BufferPool::BufferHandle* buffer) { diff --git a/be/src/service/doris_main.cpp b/be/src/service/doris_main.cpp index 680778989c7aaf..9dc3f13ef6c002 100644 --- a/be/src/service/doris_main.cpp +++ b/be/src/service/doris_main.cpp @@ -322,7 +322,9 @@ int main(int argc, char** argv) { !defined(THREAD_SANITIZER) && !defined(USE_JEMALLOC) // Aggressive decommit is required so that unused pages in the TCMalloc page heap are // not backed by physical pages and do not contribute towards memory consumption. - MallocExtension::instance()->SetNumericProperty("tcmalloc.aggressive_memory_decommit", 1); + if (doris::config::tc_enable_aggressive_memory_decommit) { + MallocExtension::instance()->SetNumericProperty("tcmalloc.aggressive_memory_decommit", 1); + } // Change the total TCMalloc thread cache size if necessary. if (!MallocExtension::instance()->SetNumericProperty( "tcmalloc.max_total_thread_cache_bytes",