Skip to content

Reduce memory retained by parsed Typography typefaces #107

Description

@charlesroddie

CSharpMath retains parsed Typography Typeface data for bundled and custom fonts. The original profile predates the current dependency snapshot. The shared, reproducible baseline is tracked in #293 and is a native prerequisite for this issue.

This issue owns reducing memory in the runtime font-loading path, especially custom LocalTypefaces; build-time precomputation for bundled fonts is separate in #191.

Acceptance criteria:

  • Use Benchmark math-font startup allocations and retained memory #293's profile to identify which OpenType tables, glyph instructions, outlines, and caches remain reachable after loading.
  • Lazily load or release data that the renderer does not need after extracting required metrics/outlines.
  • Verify repeated rendering and font switching do not reparse fonts or grow retained caches without bound.
  • Keep custom LocalTypefaces and every current rendering output working.
  • Record before/after allocations and retained memory for every bundled font and at least one custom font using the same benchmark environment.
  • Add deterministic correctness tests for any cache/lifetime policy; do not use fragile performance thresholds as correctness assertions.

A solution must remain compatible with trimming/AOT and must not dispose caller-owned typefaces unexpectedly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area/RenderingTypesetting, measurement, fonts, text layout, and drawing.Type/EnhancementA concrete change to CSharpMath behavior or capability.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions