Skip to content

Conversation

jakebailey
Copy link
Member

@Copilot Copilot AI review requested due to automatic review settings July 7, 2025 22:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that entries in checker-level stacks are explicitly zeroed out when popped to prevent memory leaks.

  • Clears the last TypeResolution entry before slicing in popTypeResolution
  • Clears the last ContextualInfo entry before slicing in popContextualType
  • Clears the last InferenceContextInfo entry before slicing in popInferenceContext

Comment on lines +29358 to +29360
lastIndex := len(c.contextualInfos) - 1
c.contextualInfos[lastIndex] = ContextualInfo{}
c.contextualInfos = c.contextualInfos[:lastIndex]
Copy link
Member Author

Choose a reason for hiding this comment

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

This is honestly better written slices.Delete, which also nils things out, but, whatever

@jakebailey jakebailey enabled auto-merge July 7, 2025 23:13
@jakebailey
Copy link
Member Author

Long term we should just have a Stack type. We probably do somewhere else, but I'd rather futz with that in a separate PR.

@jakebailey jakebailey added this pull request to the merge queue Jul 8, 2025
Merged via the queue into main with commit 9953b71 Jul 8, 2025
22 checks passed
@jakebailey jakebailey deleted the jabaile/clear-stacks branch July 8, 2025 00:53
zshannon pushed a commit to zshannon/typescript-go that referenced this pull request Oct 6, 2025
zshannon pushed a commit to zshannon/typescript-go that referenced this pull request Oct 6, 2025
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.

3 participants