Autorelease with elements in a UITableViewCell - memory leak

Posted by Shaun Budhram on Stack Overflow See other posts from Stack Overflow or by Shaun Budhram
Published on 2010-06-14T23:26:54Z Indexed on 2010/06/14 23:32 UTC
Read the original article Hit count: 244

Filed under:
|
|

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?

Also, if it helps, this is the history Leaks is displaying for this memory location. It looks like it at some point gets an additional retain message? This is not being done in my code.

alt text

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c