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

morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 06f494cc4ee branch-3.1: [fix](mow) fix potential mem leak for 
DeleteBitmap::AggCache #52596 (#52614)
06f494cc4ee is described below

commit 06f494cc4ee651f417a62f25f6bebe3e7f61fdf3
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 2 19:23:38 2025 +0800

    branch-3.1: [fix](mow) fix potential mem leak for DeleteBitmap::AggCache 
#52596 (#52614)
    
    Cherry-picked from #52596
    
    Co-authored-by: zhannngchen <[email protected]>
---
 be/src/olap/tablet_meta.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/be/src/olap/tablet_meta.h b/be/src/olap/tablet_meta.h
index 4df84c56255..a086e82e4a3 100644
--- a/be/src/olap/tablet_meta.h
+++ b/be/src/olap/tablet_meta.h
@@ -585,6 +585,12 @@ public:
             std::call_once(once, [size_in_bytes] {
                 auto* tmp = new AggCachePolicy(size_in_bytes);
                 AggCache::s_repr.store(tmp, std::memory_order_release);
+
+                // release the sigleton instance at program exit
+                std::atexit([] {
+                    auto* ptr = AggCache::s_repr.exchange(nullptr, 
std::memory_order_acquire);
+                    delete ptr;
+                });
             });
 
             while (!s_repr.load(std::memory_order_acquire)) {


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

Reply via email to