eth/downloader: dereference discarded statesync request #15545
Merged
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.
In the state synchronization structure of the downloader we are maintaining a
finished
slice containing all the currently pending responses (or timeouts) to state requests. Whenever the state processor accepts a pending item, we shift the entire slice to the left.However, since
finished
is backed by a single array internally, reducing the length by one will still keep the last item in a live (alas currently unreachable) array, and as such will keep a live memory reference to it. This in theory shouldn't matter much as it will soon enough be overwritten, but given our memory problems during sync, I'd rather avoid any such dangling GC references.