mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Clear fields on unmount of fiber to avoid memory leak (#14276)
* Clear fields on unmount of fiber to avoid memory leak
This commit is contained in:
1 parent
592676503c
commit
0e9cb3f5d0
1 file changed
+8
-3
+8
-3
@@ -728,9 +728,14 @@ function detachFiber(current: Fiber) {
|
||||
// itself will be GC:ed when the parent updates the next time.
|
||||
current.return = null;
|
||||
current.child = null;
|
||||
if (current.alternate) {
|
||||
current.alternate.child = null;
|
||||
current.alternate.return = null;
|
||||
current.memoizedState = null;
|
||||
current.updateQueue = null;
|
||||
const alternate = current.alternate;
|
||||
if (alternate !== null) {
|
||||
alternate.return = null;
|
||||
alternate.child = null;
|
||||
alternate.memoizedState = null;
|
||||
alternate.updateQueue = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user