File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,15 @@ -(enum StartUnwrapResult) _ForSource_tryStartUnwrapping:(TOCFuture*)targetFuture
84
84
// look for flattening cycles
85
85
@synchronized (getSharedCycleDetectionLock ()) {
86
86
bool didMerge = [self ._getInitCycleNode unionWith: targetFuture._getInitCycleNode];
87
- if (!didMerge) return StartUnwrapResult_CycleDetected;
87
+ if (!didMerge) {
88
+ // it's not necessary to clear the cycle nodes, but it frees up some memory
89
+ // other futures in the cycle won't get their cycle nodes cleared
90
+ // but node chains should be in EXTREMELY shallow trees
91
+ // and the nodes can't keep futures alive, so there's no reference cycle
92
+ _cycleNode = nil ;
93
+ targetFuture->_cycleNode = nil ;
94
+ return StartUnwrapResult_CycleDetected;
95
+ }
88
96
}
89
97
90
98
return StartUnwrapResult_Started;
You can’t perform that action at this time.
0 commit comments