I’m getting a memory leak when I`m trying to reset a table view, I thought I could just put release before, but this doesn’t help.
What do I need to do here ?
-(void) resetTable{
recordOffset = 10;
rOFactor = 0;
booShowMoreCell = false;
self.transactionsArray = [[NSMutableArray alloc] init]; // leak here
}
Assuming that transactionsArray is a retained property, the problem you are having is that the NSMutableArray is being retained twice.
When you set a retained property it releases the old value, and retains the new (incoming) value. The alloc method also retains the object.
So
The shortest way to resolve this is autorelease the NSMutableArray:
There’s a convenience method way for the above line: