Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Un-rendering certain components causes memory leak #20533

Closed
bendemboski opened this issue Aug 30, 2023 · 3 comments
Closed

[Bug] Un-rendering certain components causes memory leak #20533

bendemboski opened this issue Aug 30, 2023 · 3 comments

Comments

@bendemboski
Copy link
Contributor

bendemboski commented Aug 30, 2023

馃悶 Describe the Bug

Components meeting a couple of bizarrely specific conditions will leak after being un-rendered. Those conditions are:

  1. The component invokes a local helper function from its template
  2. The component registers a destructor that references this

馃敩 Minimal Reproduction

This repository's scope-pollution-leak branch contains a minimal reproduction of the issue, both via an integration test, and steps for a manual repro in the dummy app.

馃槙 Actual Behavior

When a component that meets the above conditions is un-rendered, it will not be garbage collected as long as the app is still running.

馃 Expected Behavior

All components should be garbage collected once they have been un-rendered.

馃實 Environment

  • Ember: 5.2.0
  • Node.js/npm: 16.15.1
  • OS: MacOS
  • Browser: Chrome
@bendemboski
Copy link
Contributor Author

I have verified that the repros in LTSs as far back as Ember 4.4 (although in 4.4 the local helpers have to be wrapped in helper() since Ember didn't yet support plain old functions as helpers).

@acorncom
Copy link
Contributor

Per discussions on Discord (https://discord.com/channels/480462759797063690/485447409296736276/1146624323868692520) Chris Thoburn is going to be posting an update here soon

@bendemboski
Copy link
Contributor Author

Closing in favor of #20535 which is the issue in Ember -- this issue mixes it together with some weird closure-retaining behavior that's not actually about Ember/Glimmer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants