mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-02-26 15:47:21 +00:00
core/state: clear journal entries on reset
journal.reset() reslices j.entries to length 0 but does not clear the underlying array. Since j.entries holds interface values that can reference large objects (e.g., codeChange.prevCode), this can retain memory across transactions/blocks compared to the previous newJournal() behavior.
This commit is contained in:
parent
406a852ec8
commit
9c804eddc3
1 changed files with 1 additions and 0 deletions
|
|
@ -68,6 +68,7 @@ func newJournal() *journal {
|
|||
// It is semantically similar to calling 'newJournal', but the underlying slices
|
||||
// can be reused.
|
||||
func (j *journal) reset() {
|
||||
clear(j.entries)
|
||||
j.entries = j.entries[:0]
|
||||
j.validRevisions = j.validRevisions[:0]
|
||||
clear(j.dirties)
|
||||
|
|
|
|||
Loading…
Reference in a new issue