Reputation: 2822
- (void)addChild:(MyTreeNode *)newChild {
newChild.parent = self;
[self checkForSelectedNode:newChild];
[self.children addObject:newChild];
}
In this code children is a property of the class used.The line
[self.children addObject:newChild];
is showing 100 % leak when debugging with instruments. it is properly released in the dealloc method.still it is showing leak.how to remove this leak?
Upvotes: 1
Views: 87
Reputation: 112857
In the header of MyTreeNode
the parent property should be assign not retain. Other wise there are retain cycles and memory leaks.
Explanation: Down one level the node is retaining it's parent and the parent is retaining it's child. This retain cycle will keep itself from releasing.
Upvotes: 2