iPhone app memory leak

Posted by Marian Busoi on Stack Overflow See other posts from Stack Overflow or by Marian Busoi
Published on 2010-06-14T19:17:48Z Indexed on 2010/06/14 19:22 UTC
Read the original article Hit count: 472

Filed under:
|
|

Any idea why this code gives me a memory leak? As you can see, I'm running out of ideas as to what I can do to stop it.

  • (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    NSArray *allSketches = [project.sketches allObjects];
    

    NSMutableArray *temp = [[NSMutableArray alloc] initWithArray:allSketches];

    if(sketchesArray != nil) [sketchesArray release];

    [self setSketchesArray:temp];

    [allSketches release]; allSketches = nil; [temp release]; temp = nil;

}

I also release sketchesArray inside viewDidDissapear. I'm not using viewDidLoad and dealloc to init/release these objects as what I am doing requires me to use viewWillAppear and viewDidDissapear.

Thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about nsmutablearray