You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#16087, #15157 (and other issues) point out that React keeps an alternate tree that can retain DOM elements in fibers such as the stateNode property. This can make it hard to debug memory leaks in larger sites/applications since they are a false positive.
To make the investigation process easier, would it be possible to recommend/suggest a way to somehow clean up the retainers in alternate fiber so that there is less noise?
We have some tools that do this to more or less successfully by pasring the fiber tree and setting alternate.stateNode to null.
I understand that fibers are internal API and that anything retained in alternate tree should fix itself eventually if the userland code is not leaky. However when there are leaks in userland the alternate tree can make root causing real memory leaks quite hard, even for those who are aware that retention in alternate trees is expected and a normal behaviour of React.
The text was updated successfully, but these errors were encountered:
Indeed this is a huge problem - there are many different possibilities to leak reference to a FiberNode and having a small and single reference to no longer used fiber you might have reference to a big chunk of VDOM existed at that moment.
React cleans some fibers(https://github.com/facebook/react/pull/17666/files), but the majority left up to GC to handle. While for many cases doing GC's work manually will be just a waste of CPU time, there are many other cases when it will really aid problem or at least ease discovery or the root cause, the one currently being buried very deep down in a fiber's cyclic structure.
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
Hi,
#16087, #15157 (and other issues) point out that React keeps an alternate tree that can retain DOM elements in fibers such as the
stateNode
property. This can make it hard to debug memory leaks in larger sites/applications since they are a false positive.To make the investigation process easier, would it be possible to recommend/suggest a way to somehow clean up the retainers in alternate fiber so that there is less noise?
We have some tools that do this to more or less successfully by pasring the fiber tree and setting
alternate.stateNode
tonull
.I understand that fibers are internal API and that anything retained in alternate tree should fix itself eventually if the userland code is not leaky. However when there are leaks in userland the alternate tree can make root causing real memory leaks quite hard, even for those who are aware that retention in alternate trees is expected and a normal behaviour of React.
The text was updated successfully, but these errors were encountered: