From 2cd52c9ff3a3fa09aad7d35bbab8b9bbc86d2498 Mon Sep 17 00:00:00 2001 From: Stefan Boberg Date: Fri, 8 Nov 2024 15:27:08 +0100 Subject: memory leak fix (GetBatchHandle) (#215) This fixes a memory leak which would cause stale handles to accumulate until process shutdown. Each cache get operation would therefore leak some memory. --- src/zenstore/cache/cachedisklayer.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/zenstore/cache/cachedisklayer.cpp') diff --git a/src/zenstore/cache/cachedisklayer.cpp b/src/zenstore/cache/cachedisklayer.cpp index 8c93d8a3a..4aafb9828 100644 --- a/src/zenstore/cache/cachedisklayer.cpp +++ b/src/zenstore/cache/cachedisklayer.cpp @@ -1313,6 +1313,8 @@ struct ZenCacheDiskLayer::CacheBucket::GetBatchHandle ResultIndexes.reserve(OutResults.capacity()); } + ~GetBatchHandle() {} + std::vector Keys; std::vector ResultIndexes; @@ -1625,6 +1627,8 @@ ZenCacheDiskLayer::CacheBucket::EndGetBatch(GetBatchHandle* Batch) noexcept } } } + + delete Batch; } catch (const std::exception& Ex) { -- cgit v1.2.3