Search code examples
iphoneipadmemory-leaksinstruments

Problem with memory leaks using instruments


i was checking for memory leaks by using instruments and found a leak in the below code

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
self.highlighted = NO;
[[self gridView] selectRow:self.yPosition column:self.xPosition scrollPosition:MFGridViewScrollPositionNone animated:YES];
[self.delegate gridViewCellWasTouched:self];//**showing leak in this line**
[super touchesEnded:touches withEvent:event];

}

But, i completely fail to understand what is the leak in the above mentioned line.. There were many more similar leaks which are being shown in instruments. Can anyone help me with these... Thank you.


Solution

  • It is really hard to say where is the leak here, because nobody sees the whole picture. You have to track down the stack trace until you reach some call to system library. This would be the endpoint from which you should search for the leak. It really doesn't mean that the leak is exactly there. But there would be a leaking object there for sure.