From ecef7bdcbce4abf9f230377ba6df0b63399fc189 Mon Sep 17 00:00:00 2001 From: obdev Date: Wed, 11 Jan 2023 13:08:13 +0000 Subject: [PATCH] fix memory leak when the TabletStatMgr is destroyed --- src/storage/ob_tenant_tablet_stat_mgr.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/storage/ob_tenant_tablet_stat_mgr.cpp b/src/storage/ob_tenant_tablet_stat_mgr.cpp index f0bf440744..5f20487f92 100644 --- a/src/storage/ob_tenant_tablet_stat_mgr.cpp +++ b/src/storage/ob_tenant_tablet_stat_mgr.cpp @@ -286,7 +286,13 @@ void ObTabletStreamPool::destroy() DLIST_REMOVE_ALL_NORET(node, lru_list_) { lru_list_.remove(node); - node->~ObTabletStreamNode(); + if (DYNAMIC_ALLOC == node->flag_) { + node->~ObTabletStreamNode(); + // ObFIFOAllocator::reset does not release memory by default. + dynamic_allocator_.free(node); + } else { + node->~ObTabletStreamNode(); + } node = nullptr; } lru_list_.reset(); @@ -512,7 +518,9 @@ int ObTenantTabletStatMgr::report_stat(const ObTabletStat &stat) uint64_t pending_cur = ATOMIC_LOAD(&pending_cursor_); uint64_t report_cur = ATOMIC_LOAD(&report_cursor_); if (pending_cur - report_cur + 1 == DEFAULT_MAX_PENDING_CNT) { // full queue - LOG_INFO("report_queue is full, wait to process", K(report_cur), K(pending_cur), K(stat)); + if (REACH_TENANT_TIME_INTERVAL(10 * 1000L * 1000L/*10s*/)) { + LOG_INFO("report_queue is full, wait to process", K(report_cur), K(pending_cur), K(stat)); + } break; } else if (pending_cur != ATOMIC_CAS(&pending_cursor_, pending_cur, pending_cur + 1)) { ++retry_cnt;