Skip to content

Conversation

@slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Dec 12, 2025

6.3 cherry-pick of #86020.

  • Description: Preserving sugar if we have type variables uses way too much memory. Canonicalize these substitution maps for now, as a (temporary?) workaround. In the future, if we decide preserving sugar is more important than a few dozen Mb of memory usage, we can also bump the arena memory limit, instead.

  • Origination: Regression in space usage introduced by AST: Allow non-canonical opaque archetypes #84299.

  • Radar: Fixes rdar://166237860, rdar://165863647.

  • Tested: The failure consists of rather complex SwiftUI Views that were already close to the 512Mb limit, now exceeding that limit. It's hard to come up with a self-contained test case. Observing the lack of sugar is difficult too, since the preservation of sugar was added to clean up some logic in the ASTPrinter for module interfaces, and in that case we don't have type variables. So there is no test case, but existing tests pass obviously.

  • Reviewed by: @xedin

Preserving sugar if we have type variables uses way too much memory.

Canonicalize these substitution maps for now, as a (temporary?) workaround.

In the future, if we decide preserving sugar is more important than a
few dozen Mb of memory usage, we can also bump the arena memory limit,
instead.

Fixes rdar://166237860.
Fixes rdar://165863647.
@slavapestov slavapestov requested a review from a team as a code owner December 12, 2025 23:13
Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Looks like a good tradeoff to me, thanks!

@slavapestov
Copy link
Contributor Author

@swift-ci Please test

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.

2 participants