This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new e7aa131506 [enhancement](tcmalloc) add aggressive_memory_decommit conf 
and make it disable (#12436)
e7aa131506 is described below

commit e7aa1315067b42116af06d198860561a805574a5
Author: yixiutt <102007456+yixi...@users.noreply.github.com>
AuthorDate: Thu Sep 8 08:37:16 2022 +0800

    [enhancement](tcmalloc) add aggressive_memory_decommit conf and make it 
disable (#12436)
    
    Co-authored-by: yixiutt <yi...@selectdb.com>
---
 be/src/common/config.h                        | 2 ++
 be/src/runtime/bufferpool/system_allocator.cc | 8 --------
 be/src/service/doris_main.cpp                 | 4 +++-
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/be/src/common/config.h b/be/src/common/config.h
index 6a21eaf746..a099de3c4f 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 9a576d9488..cc5f7b7a27 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 680778989c..9dc3f13ef6 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",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to