-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trie: fixes two issues in trie iterator #24539
Merged
Merged
Conversation
This file contains 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
In trie iterator a batch of live nodes will be tracked and be poped when it's iterated. However the poped node state should be explictly set to nil in order to be garbage collected.
holiman
approved these changes
Mar 15, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
sidhujag
pushed a commit
to syscoin/go-ethereum
that referenced
this pull request
Mar 16, 2022
* trie: fix memory leak in trie iterator In the trie iterator, live nodes are tracked in a stack while iterating. Popped node states should be explictly set to nil in order to get garbage-collected. * trie: fix empty trie iterator
JacekGlen
pushed a commit
to JacekGlen/go-ethereum
that referenced
this pull request
May 26, 2022
* trie: fix memory leak in trie iterator In the trie iterator, live nodes are tracked in a stack while iterating. Popped node states should be explictly set to nil in order to get garbage-collected. * trie: fix empty trie iterator
maoueh
pushed a commit
to streamingfast/go-ethereum
that referenced
this pull request
Sep 30, 2022
* trie: fix memory leak in trie iterator In the trie iterator, live nodes are tracked in a stack while iterating. Popped node states should be explictly set to nil in order to get garbage-collected. * trie: fix empty trie iterator
cp-wjhan
pushed a commit
to cp-yoonjin/go-wemix
that referenced
this pull request
Nov 16, 2022
* trie: fix memory leak in trie iterator In the trie iterator, live nodes are tracked in a stack while iterating. Popped node states should be explictly set to nil in order to get garbage-collected. * trie: fix empty trie iterator
0xmountaintop
pushed a commit
to scroll-tech/go-ethereum
that referenced
this pull request
May 28, 2024
* trie: fix memory leak in trie iterator In the trie iterator, live nodes are tracked in a stack while iterating. Popped node states should be explictly set to nil in order to get garbage-collected. * trie: fix empty trie iterator
0xmountaintop
added a commit
to scroll-tech/go-ethereum
that referenced
this pull request
May 28, 2024
* trie: fix two issues in trie iterator (ethereum#24539) * trie: fix memory leak in trie iterator In the trie iterator, live nodes are tracked in a stack while iterating. Popped node states should be explictly set to nil in order to get garbage-collected. * trie: fix empty trie iterator * fix lint * chore: auto version bump [bot] --------- Co-authored-by: rjl493456442 <garyrong0905@gmail.com> Co-authored-by: HAOYUatHZ <HAOYUatHZ@users.noreply.github.com>
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.
This PR fixes two issues in iterator:
In trie iterator each resolved trie node will be wrapped with a struct and the corresponding pointer will be saved in the stack based slice. Whenever the node is visited, the struct is poped from stack. However this struct point should be explicitly set to nil in order to garbage collect the underlying struct.
The empty trie shouldn't be iterated out any values.