aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2024-11-08 15:27:08 +0100
committerGitHub Enterprise <[email protected]>2024-11-08 15:27:08 +0100
commit2cd52c9ff3a3fa09aad7d35bbab8b9bbc86d2498 (patch)
treea3d2e1c4f091a36350b18c450f160dd848c5f3a5
parent5.5.10 (diff)
downloadzen-2cd52c9ff3a3fa09aad7d35bbab8b9bbc86d2498.tar.xz
zen-2cd52c9ff3a3fa09aad7d35bbab8b9bbc86d2498.zip
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.
-rw-r--r--CHANGELOG.md1
-rw-r--r--src/zenstore/cache/cachedisklayer.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c477d6f13..b157af66c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- Bugfix: If zenserver fails to pick up a request for a sponsor process, make sure to clear the slot
- Bugfix: Fix potential hole where an chunk could be lost during GC if the package referenced a chunk that already existed in store
- Bugfix: Make op key and file path matching in `zen oplog-mirror` case insensitive
+- Bugfix: Fixed memory leak in cache (would leak GetBatchHandle instances)
## 5.5.9
- Feature: Added command `zen cache-get` to fetch a cache value/record or an attachment from a cache record
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<IoHash> Keys;
std::vector<size_t> ResultIndexes;
@@ -1625,6 +1627,8 @@ ZenCacheDiskLayer::CacheBucket::EndGetBatch(GetBatchHandle* Batch) noexcept
}
}
}
+
+ delete Batch;
}
catch (const std::exception& Ex)
{