You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added comprehensive test coverage for memory usage calculations across string encodings, validating memory bounds for embedded strings, raw strings, and integer-encoded keys.
✏️ Tip: You can customize this high-level summary in your review settings.
The changes refactor memory size estimation functionality from robj-based to kvobj-based computation. A new function kvobjComputeSize is introduced with updated accounting logic for various object encodings. The OBJECT USAGE invocation path is updated to use this new function. Test comments are updated to reflect the new function name, and a new test validates memory usage behavior for string-encoded keys.
Changes
Cohort / File(s)
Summary
Core Size Computation src/object.c
Introduced kvobjComputeSize function for kvobj-based size estimation, removing explicit robj header accounting in favor of malloc_usable_size and incremental asize accumulation. Updated OBJECT USAGE command to call the new function instead of the original objectComputeSize.
Test Comment Updates tests/unit/type/hash.tcl, tests/unit/type/list.tcl
Updated test comments from "coverage for objectComputeSize" to "coverage for kvobjComputeSize" to reflect the refactored function name. No functional changes to test logic.
Added new "MEMORY USAGE - STRINGS" test block that validates memory usage for various key and value sizes, covering EMBSTR/RAW and OBJ_ENCODING_INT encodings with explicit bounds assertions.
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
🐰 A kvobj takes the stage so new,
where malloc's magic makes sizes true.
From robj's chains we're breaking free,
accounting every byte we see.
Hop along, the code's redrawn!
Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The title directly addresses the main objective of the PR, which is to fix the MEMORY USAGE command by refactoring it to use the new kvobj-based computation function.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing touches
📝 Generate docstrings
🧪 Generate unit tests (beta)
Create PR with unit tests
Post copyable unit tests in a comment
Commit unit tests in branch coderabbit_full_head_fix_memory_usage_command_pr5
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
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
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.
Benchmark PR from agentic-review-benchmarks#5
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.