-
-
Notifications
You must be signed in to change notification settings - Fork 796
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
stop holding a reference to a Promise when it is resolved #1284
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
d20333a
to
4bdf471
Compare
This looks much simpler! Thanks for updating it. Do you think it's worth adding a comment to explain why we're doing it this way? Feel free to paste a link back to this PR for context. |
Yes I was actually thinking about explaining it but since there were no comments I restrained myself. I'll comment it. |
For reference, this PR addresses unresolved points we had in #1249 relative to the handling of Promises in the In some browser implementations, the Promise objects seem to cause a leak by retaining all the code that used The "fix" is to remove the Promise objects from the Map once they've resolved to make sure they don't retain anyone. |
4bdf471
to
6d00d25
Compare
Force pushed with the comments. |
6d00d25
to
0d3d5d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
I'm coming back on this closed PR : https://astegmaier.github.io/cached-promise-memory-leak/index.html
I still observe memory leaks in my application due to the includeFile Map. It would seem there is some regression around Promises in Chrome at least.
Wouldn't it still be somewhat better to guard against this possibility by not holding the promise objects in the Map to be sure ?
This approach is a lot simpler (I forgot that
Promise.resolve()
actually unboxes Promises), maybe you would consider it mergeable ?