Skip to content

Clear out checker-level stacks on pop #1369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2025
Merged

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
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