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

zouxinyi 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 51508cfe5e6 [fix](memory) Fix memory log compile by ASAN (#33162)
51508cfe5e6 is described below

commit 51508cfe5e6100419a4eb17281310ba7a26a610f
Author: Xinyi Zou <[email protected]>
AuthorDate: Wed Apr 3 19:00:15 2024 +0800

    [fix](memory) Fix memory log compile by ASAN (#33162)
    
    ASAN compiles BE, add markers in memory logs
---
 be/src/runtime/memory/mem_tracker_limiter.cpp | 4 ++++
 be/src/util/mem_info.cpp                      | 9 +++++++++
 be/src/util/perf_counters.cpp                 | 4 ++++
 3 files changed, 17 insertions(+)

diff --git a/be/src/runtime/memory/mem_tracker_limiter.cpp 
b/be/src/runtime/memory/mem_tracker_limiter.cpp
index 84b80699431..08d8ea4d5e2 100644
--- a/be/src/runtime/memory/mem_tracker_limiter.cpp
+++ b/be/src/runtime/memory/mem_tracker_limiter.cpp
@@ -202,7 +202,11 @@ void 
MemTrackerLimiter::make_process_snapshots(std::vector<MemTracker::Snapshot>
     snapshot.peak_consumption = -1;
     (*snapshots).emplace_back(snapshot);
 
+#ifdef ADDRESS_SANITIZER
+    snapshot.type = "[ASAN]process resident memory"; // from /proc VmRSS VmHWM
+#else
     snapshot.type = "process resident memory"; // from /proc VmRSS VmHWM
+#endif
     snapshot.label = "";
     snapshot.limit = -1;
     snapshot.cur_consumption = PerfCounters::get_vm_rss();
diff --git a/be/src/util/mem_info.cpp b/be/src/util/mem_info.cpp
index f26c4f9fe74..3caee29921c 100644
--- a/be/src/util/mem_info.cpp
+++ b/be/src/util/mem_info.cpp
@@ -393,6 +393,15 @@ void MemInfo::refresh_proc_meminfo() {
         _s_sys_mem_available.store(_mem_info_bytes["MemAvailable"], 
std::memory_order_relaxed);
         _s_sys_mem_available_str = PrettyPrinter::print(
                 _s_sys_mem_available.load(std::memory_order_relaxed), 
TUnit::BYTES);
+#ifdef ADDRESS_SANITIZER
+        _s_sys_mem_available_str =
+                "[ASAN]" +
+                
PrettyPrinter::print(_s_sys_mem_available.load(std::memory_order_relaxed),
+                                     TUnit::BYTES);
+#else
+        _s_sys_mem_available_str = PrettyPrinter::print(
+                _s_sys_mem_available.load(std::memory_order_relaxed), 
TUnit::BYTES);
+#endif
     }
 }
 
diff --git a/be/src/util/perf_counters.cpp b/be/src/util/perf_counters.cpp
index 67a9c013e1d..18fb9766ada 100644
--- a/be/src/util/perf_counters.cpp
+++ b/be/src/util/perf_counters.cpp
@@ -585,7 +585,11 @@ void PerfCounters::refresh_proc_status() {
     _vm_size = parse_bytes("status/VmSize");
     _vm_peak = parse_bytes("status/VmPeak");
     _vm_rss = parse_bytes("status/VmRSS");
+#ifdef ADDRESS_SANITIZER
+    _vm_rss_str = "[ASAN]" + PrettyPrinter::print(_vm_rss, TUnit::BYTES);
+#else
     _vm_rss_str = PrettyPrinter::print(_vm_rss, TUnit::BYTES);
+#endif
     _vm_hwm = parse_bytes("status/VmHWM");
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to