Skip to content

Recycle type checkers under a configurable memory budget - #64819

Draft
Daniel Rosenwasser (DanielRosenwasser) with Copilot wants to merge 3 commits into
mainfrom
copilot/optimize-checker-memory-usage
Draft

Daniel Rosenwasser (DanielRosenwasser) with Copilot wants to merge 3 commits into
mainfrom
copilot/optimize-checker-memory-usage

Conversation

Copilot AI commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Large programs retain substantial checker-owned state, causing memory usage to grow throughout type checking. This change adds opt-in checker recycling for memory-constrained compilation.

Changes

  • Adds --maxMemory <MiB> for non-incremental --noEmit compilation.
  • Replaces checker-pointer affinity with stable pool slots, allowing checker replacement without reassigning files.
  • Recycles checkers between checked files when live heap allocation exceeds the configured budget.
  • Preserves retired checkers’ global diagnostics and aggregate symbol, type, and instantiation counts.
  • Avoids recycling after skipped files or after a slot’s final checked file.
  • Disables recycling where checker-owned state must survive, including declaration emit, tracing, incremental compilation, and watch mode.
  • Reports Checkers retired under extended diagnostics.
tsgo -p tsconfig.json --noEmit --checkers 8 --maxMemory 8192

Copilot AI and others added 3 commits October 14, 2026 21:16
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
Co-authored-by: DanielRosenwasser <972891+DanielRosenwasser@users.noreply.github.com>
@DanielRosenwasser

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) perf test this

@typescript-automation

Copy link
Copy Markdown
Contributor

Hey Daniel Rosenwasser (@DanielRosenwasser), this PR was updated less than two minutes before this command. Please wait until it has been unchanged for two minutes and try again.

This branch has not been deployed

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

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants