Skip to content

enhance: share TextMate registry across editors to reduce memory usage (#2396)#2397

Closed
gadfly3173 wants to merge 1 commit into
sourcegit-scm:developfrom
gadfly3173:fix/textmate-shared-registry
Closed

enhance: share TextMate registry across editors to reduce memory usage (#2396)#2397
gadfly3173 wants to merge 1 commit into
sourcegit-scm:developfrom
gadfly3173:fix/textmate-shared-registry

Conversation

@gadfly3173
Copy link
Copy Markdown
Contributor

Each text editor previously created its own RegistryOptionsWrapper with an independent grammar cache, causing redundant TextMate grammar loading when viewing files of the same type in different editors. Over long sessions this accumulated hundreds of megabytes of duplicated grammar data in the managed heap.

  • Make RegistryOptionsWrapper a lazy singleton per theme (dark/light) so all editors share one grammar cache.
  • Move LastScope tracking from the shared wrapper to a per-editor ref string parameter to avoid cross-editor state conflicts.
  • Add DisposeInstallation helper for consistent cleanup.

sourcegit-scm#2396)

Each text editor previously created its own `RegistryOptionsWrapper` with
an independent grammar cache, causing redundant TextMate grammar loading
when viewing files of the same type in different editors. Over long sessions
this accumulated hundreds of megabytes of duplicated grammar data in the
managed heap.

- Make `RegistryOptionsWrapper` a lazy singleton per theme (dark/light)
  so all editors share one grammar cache.
- Move `LastScope` tracking from the shared wrapper to a per-editor
  `ref string` parameter to avoid cross-editor state conflicts.
- Add `DisposeInstallation` helper for consistent cleanup.
@gadfly3173 gadfly3173 closed this May 28, 2026
@gadfly3173 gadfly3173 deleted the fix/textmate-shared-registry branch May 28, 2026 06:27
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