Skip to content

db/state: bound commitmentValTransformDomain key caches#21929

Merged
AskAlexSharov merged 3 commits into
mainfrom
alex/commitment_keycache_cap_36
Jun 23, 2026
Merged

db/state: bound commitmentValTransformDomain key caches#21929
AskAlexSharov merged 3 commits into
mainfrom
alex/commitment_keycache_cap_36

Conversation

@AskAlexSharov

@AskAlexSharov AskAlexSharov commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

The per-merge findShortenedKey caches added in #21303 (storageKeyCache / accountKeyCache in commitmentValTransformDomain) have no size bound. On with-deref-files merge - it acts as mem-leak.

The per-merge findShortenedKey caches added in #21303 had no size bound:
on a whole-state commitment merge they grow one entry per distinct
account/storage key, reaching multiple GB (a heap profile showed 4.3GB
live in the replacer closure). Clear each cache when it exceeds
keyCacheMaxEntries (4M) so memory stays bounded while hot recurring keys
are still cached.

@Giulio2002 Giulio2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — bounds the temporary key caches to avoid unbounded growth during a merge without changing the lookup behavior.

@Giulio2002 Giulio2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — obvious safety bound on per-merge key caches to prevent unbounded growth.

@Giulio2002 Giulio2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — simple, obviously safe bound on per-merge key caches to avoid unbounded growth.

@AskAlexSharov AskAlexSharov added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit cfc031d Jun 23, 2026
95 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/commitment_keycache_cap_36 branch June 23, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants