Skip to content

Commit

Permalink
Merge branch 'master' of github.com:facebook/FBRetainCycleDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
megCanicalKb committed Nov 20, 2017
2 parents 013362e + fbb0053 commit d41dde7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions FBRetainCycleDetector/Detector/FBRetainCycleDetector.mm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ - (void)addCandidate:(id)candidate
[_candidates removeAllObjects];
[_objectSet removeAllObjects];

// Filter cycles that have been broken down since we found them.
// These are false-positive that were picked-up and are transient cycles.
NSMutableSet<NSArray<FBObjectiveCGraphElement *> *> *brokenCycles = [NSMutableSet set];
for (NSArray<FBObjectiveCGraphElement *> *itemCycle in allRetainCycles) {
for (FBObjectiveCGraphElement *element in itemCycle) {
if (element.object == nil) {
// At least one element of the cycle has been removed, thus breaking
// the cycle.
[brokenCycles addObject:itemCycle];
break;
}
}
}
[allRetainCycles minusSet:brokenCycles];

return allRetainCycles;
}

Expand Down
2 changes: 1 addition & 1 deletion FBRetainCycleDetector/Graph/FBObjectiveCBlock.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ - (NSString *)classNameOrNull
{
NSString *className = NSStringFromClass([self objectClass]);
if (!className) {
className = @"Null";
className = @"(null)";
}

if (!self.configuration.shouldIncludeBlockAddress) {
Expand Down
2 changes: 1 addition & 1 deletion FBRetainCycleDetector/Graph/FBObjectiveCGraphElement.mm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ - (NSString *)classNameOrNull
{
NSString *className = NSStringFromClass([self objectClass]);
if (!className) {
className = @"Null";
className = @"(null)";
}

return className;
Expand Down

0 comments on commit d41dde7

Please sign in to comment.