Jules
Jules

Reputation: 7774

Obj-C, zombies memory leak, I can't see it?

I think I've got a memory leak, I've enabled zombies and in profiler it highlighted this section of code, I've marked the percentages.

It looks fine to me.

Any ideas ?

    [NSThread detachNewThreadSelector:@selector(threadStartAnimating:) 
              toTarget:self withObject:nil];

    NSMutableArray *tmpArray = [[NSMutableArray alloc]init];

    if (metadata.isDirectory) {
        for (DBMetadata *file in [metadata.contents reverseObjectEnumerator]) {
            [tmpArray addObject:file.filename];  -- 44%
        }
    }

    self.itemArray = tmpArray;
    [tmpArray release];

    [self.dropboxTableView reloadSections:[NSIndexSet indexSetWithIndex:0] 
             withRowAnimation:UITableViewRowAnimationFade]; -- 55.6%

    [activityIndicator stopAnimating];

EDIT

In the interface :-

NSMutableArray *itemArray;

Upvotes: 0

Views: 180

Answers (1)

modusCell
modusCell

Reputation: 13429

i think the thread generate leaks here if you do not use NSAutoreleasePool?

-(void)threadStartAnimating
{
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
        //your code.
        [pool release];
}

thanks.

Upvotes: 1

Related Questions