Repository navigation
Account for shared strings proportionally in JSON memory usage - #1645
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1645 +/- ##
=======================================
Coverage 85.97% 85.97%
=======================================
Files 15 15
Lines 5306 5306
=======================================
Hits 4562 4562
Misses 744 744 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
JSON memory reporting currently charges the full string allocation for every reference, even when multiple references share the same allocation. This change divides each string’s allocation size—including its header and padding—by its global reference count. Arrays and objects sum these contributions, retaining fractional bytes until the final result is rounded to an integer. Align Ijson
TalBarYakar
force-pushed
the
tal.ba/bug/mem_usage_prop
branch
from
October 5, 2026 06:15
1773290 to
eb7f1b1
Compare
AvivDavid23
approved these changes
Oct 5, 2026
This was referenced Oct 12, 2026
Merged
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.
JSON memory reporting currently charges the full string allocation for every reference, even when multiple references share the same allocation. This change divides each string’s allocation size—including its header and padding—by its global reference count. Arrays and objects sum these contributions, retaining fractional bytes until the final result is rounded to an integer. Align Ijson
Note
Medium Risk
Changes how reported JSON key memory is computed for commands that use
get_memory, which can shift monitoring and limits without affecting stored data.Overview
JSON memory reporting no longer counts the full backing allocation for every copy of the same interned string. The
ijsondependency is bumped somem_allocated()splits each string’s allocation (including header/padding) by its global reference count and keeps fractional bytes while aggregating containers.RedisIValueJsonKeyManager::get_memorynow rounds(mem_allocated() + size_of::<IValue>())as a float before returning bytes, matching that fractional accounting. A new unit test asserts that ten clones of one string each report one-tenth of the allocation, and that the sole survivor reports the full size again after the clones are dropped.Reviewed by Cursor Bugbot for commit eb7f1b1. Bugbot is set up for automated code reviews on this repo. Configure here.