fix: correct accounting in DictEncoder::estimated_memory_size#9720
Open
mzabaluev wants to merge 1 commit intoapache:mainfrom
Open
fix: correct accounting in DictEncoder::estimated_memory_size#9720mzabaluev wants to merge 1 commit intoapache:mainfrom
DictEncoder::estimated_memory_size#9720mzabaluev wants to merge 1 commit intoapache:mainfrom
Conversation
The returned value should estimate the actual memory usage, but instead it used the evaluation of the encoded size of the dictionary data, and bypassed the hash table memory usage added by the Interner. The implementation of Storage::estimated_memory_size for the unique key storage was not correct as well, but it was unused. Correct both problems.
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 does this PR close?
DictEncoder::estimated_memory_size#9719.Rationale for this change
The returned value should estimate the actual memory usage, but instead it uses the evaluation of the encoded size of the dictionary data, and bypasses the hash table memory usage added by the
Internermember. The implementation ofStorage::estimated_memory_sizeimplementation for the unique key storage was not correct as well, but it was unused.What changes are included in this PR?
Correct both problems by making the
KeyStorage's implementation ofestimated_memory_sizereturn the size of the allocateduniquesvector, and makeDictEncoder::estimated_memory_sizedelegate to theinterner, which calls the method ofKeyStorageand adds accounting for its own data structure.Are these changes tested?
No. I've discovered no existing tests exercising this method, either.
Are there any user-facing changes?
No.