Conversation
joerunde
reviewed
Apr 6, 2022
joerunde
reviewed
Apr 6, 2022
|
I guess there's probably no good way to unit test this change? Except maybe by creating a whole load of |
Motivation Currently, RangeCache will implicitly retain a reference to the RangeResponse KeyValue arrays used to initially populate/refresh the cache via the promise held in its startFuture field. This ref is there only to propagate cancellation to the etcd range request but can take up significant memory once completed if the cache is large. Note this is mostly the size of the object array itself since the contained objects will usually be referenced from the cache's map. However over time unnecessary references could remain if/when the corresponding KeyValues are deleted. The array's "shallow" footprint might also be non-negligible for very large caches. Modifications - Change the promise used for the start future to hold an explicit reference to the range request future, so that it can be nulled as soon as that other future completes. - Remove an incorrect assertion
1f339eb to
f59606a
Compare
Contributor
Author
Not a good way that I can think of, unless we introduce nonfunctional tests to track heap consumption etc. |
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.
Motivation
Currently,
RangeCachewill implicitly retain a reference to theRangeResponseKeyValue arrays used to initially populate/refresh the cache via the promise held in itsstartFuturefield.This ref is there only to propagate cancellation to the etcd range request but can take up significant memory once completed if the cache is large.
Note this is mostly the size of the object array itself since the contained objects will usually be referenced from the cache's map. However over time unnecessary references could remain if/when the corresponding KeyValues are deleted. The array's "shallow" footprint might also be non-negligible for very large caches.
Modifications
@Nullableimport