我得到這兩種方法的內存泄漏警告。第二個叫第一個,顯然是泄漏的內存。有任何想法嗎?調用subtreebordercolor時潛在的對象泄漏
static UIColor *subtreeBorderColor(void)
{
return [UIColor colorWithRed:0.0f green:0.5f blue:0.0f alpha:1.0f];
}
- (void) updateSubtreeBorder
{
CALayer *layer = [self layer];
if (layer) {
// If the enclosing TreeGraph has its "showsSubtreeFrames" debug feature enabled,
// configure the backing layer to draw its border programmatically. This is much more efficient
// than allocating a backing store for each SubtreeView's backing layer, only to stroke a simple
// rectangle into that backing store.
PSBaseTreeGraphView *treeGraph = [self enclosingTreeGraph];
if ([treeGraph showsSubtreeFrames]) {
[layer setBorderWidth:subtreeBorderWidth()];
[layer setBorderColor:[subtreeBorderColor() CGColor]];
} else {
[layer setBorderWidth:0.0];
}
}
}
//3: Potential leak of an object
//6: Calling 'subtreeBorderColor'
//1: Entered call from 'updateSubtreeBorder'
//13: Method returns an Objective-C object with a +0 retain count
//12: Reference count incremented. The object now has a +1 retain count
//6: Returning from 'subtreeBorderColor'
//13: Object leaked: allocated object is not referenced later in this execution path and has a retain count of +1
更新2:我只是完全改變了代碼和刪除臨時文件和清潔解決方案,這是我看到的 - 它發現錯誤,其中甚至沒有代碼
試過,我仍然得到相同的內存泄漏警告 – TheLearner
@TheLearner然後你在其他地方泄漏內存。這是您發佈的代碼**中的**問題。* – 2012-10-01 14:26:30
沒有其他內存泄漏警告。在刪除第一個方法中的保留之後,請參閱警告列表的更新 – TheLearner