-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
React Example Node Leak #1332
Comments
Event listener? Afaik there are only react event listeners in there and they're all released correctly. Maybe it's something else? |
Hi @chenglou thanks for getting back. One thing that seems suspicious to me is the fact that once I started my test steps an event listener was bound and then never released even after a forced GC. Is this expected? |
After a new round of profiling @chenglou and warming the initial render state (adding and removing one todo) before starting my tests I am confident that there is a leak in this example. Note how the heap size increases and I have a whole bunch of new ReactElements between each test: Also each time I go through the steps of my test I end up with more nodes each run: Based on this information I am quite confident there is a leak in this example (unless there is some caching behavior that can be accounted for) Let me know if I can be of any more help |
If you add some todos and remove them before taking the first snapshot, you shouldn't see the listener. This is because React adds a single top-level listener for each event used and some events are not used except by the The new ReactElements in the heap snapshot are there because each time you call render, new elements are allocated – but the old ones that they replace are freed, so there shouldn't be a real leak. |
Hey @spicyj thanks for getting back to me, I agree there is no listener leak that was a mistake on my part. As far as the ReactElement issue, I have codified the process here #1368 and am still seeing a growth over time (even with a forced GC), let me know if this expected or if I have missed something. Thanks again for your time! |
Closing since React was updated #2202 |
Steps to reproduce
It seems like one event listener is not getting unbound, this seems like a leak. ⛲
The text was updated successfully, but these errors were encountered: