Skip to content

Bound the parsed font cache - #6

Closed
KickNext wants to merge 7 commits into
mainfrom
agent/bound-font-cache
Closed

Bound the parsed font cache#6
KickNext wants to merge 7 commits into
mainfrom
agent/bound-font-cache

Conversation

@KickNext

@KickNext KickNext commented Aug 17, 2026

Copy link
Copy Markdown
Owner

What changed

  • replace the unbounded parsed OpenTypeFont map with the existing size-aware LRU cache
  • retain at most 32 parsed font assets or 32 MiB of copied font bytes
  • preserve concurrent-load sharing and failed-load retry behavior
  • add a regression test proving the least-recently-used font is reloaded after eviction

Why

FontAssetResolver already bounded decoded glyphs, sampled shapes, and morph plans, but retained every parsed font forever. Each OpenTypeFont owns a copy of the source bytes, so apps touching many icon font assets could grow retained memory without a limit despite morphnext documenting bounded caching.

Verification

The regression test was first run against the previous implementation and failed with Expected: 2, Actual: 1 after loading 33 font assets.

Final GitHub Actions checks are green:

  • Dart formatting
  • Flutter analyzer with fatal infos/warnings
  • 115 package tests with coverage and the 90% coverage gate
  • Chrome smoke test
  • example tests and release web build
  • dart pub publish --dry-run
  • maximum pana score gate

No public API changes.

@KickNext KickNext closed this Aug 17, 2026
@KickNext
KickNext deleted the agent/bound-font-cache branch August 17, 2026 07:58
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.

1 participant