[ISSUE #10912] Fix native memory leak in PopConsumerRocksdbStore - #10913
Open
majialoong wants to merge 1 commit into
Open
[ISSUE #10912] Fix native memory leak in PopConsumerRocksdbStore#10913majialoong wants to merge 1 commit into
majialoong wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #10913 +/- ##
=============================================
- Coverage 48.46% 48.35% -0.12%
+ Complexity 13584 13553 -31
=============================================
Files 1380 1380
Lines 101195 101197 +2
Branches 13130 13130
=============================================
- Hits 49040 48929 -111
- Misses 46188 46279 +91
- Partials 5967 5989 +22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RockteMQ-AI
approved these changes
Aug 12, 2026
RockteMQ-AI
left a comment
Contributor
There was a problem hiding this comment.
Summary
This PR fixes a native memory leak in PopConsumerRocksdbStore.scanExpiredRecords() by properly closing RocksDB Slice objects in a try-with-resources block.
The fix is correct — Slice objects hold native (off-heap) memory via RocksDB's C++ layer and must be explicitly closed. Previously, they were created inline inside ReadOptions and never released, causing a native memory leak under sustained pop-consume traffic.
LGTM. Clean, minimal fix.
Automated review by github-manager-bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which Issue(s) This PR Fixes
Brief Description
Close the RocksDB Slice objects created in
scanExpiredRecords()to prevent native memory leaks.How Did You Test This Change?
Ran the existing PopConsumerRocksdbStoreTest and verified that native memory remains stable during repeated scans.