In my 'cellForRowAtIndexPath' method for a UITableView delegate, I'm allocating a cell if it doesn't exist, and in this cell, I'm creating a new activity spinner like so:
UIActivityIndicatorView *actView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray ] autorelease];
I'm using Leaks to detect memory leaks in my program, and for some reason, this is coming up as a leak, even though it's autoreleasing. The cell itself is also autoreleasing. Has anyone had experience with autoreleasing variables coming up as leaks in the Leaks instrument, and how to tackle these problems?
This is only leaking if I add it to the cell's contentView. If I just create it and let it be, the Leak instrument doesn't report any problem.
Also, if it helps, this is the history Leaks is displaying for this memo开发者_JS百科ry location. It looks like it at some point gets an additional retain message? This is not being done in my code.
Is the containing cell being released?
If not, are you ever removing the UIActivityIndicatorView instance from the containing cell?
I've come to the conclusion that this is due to the simulator - I do not receive these leaks on the actual device.
精彩评论