0
votes

Are these kind of leaks normal? Are they false leaks or something I should be concerned with? The instruments tool doesn't give me any line of code from my app, seems Apple's frameworks are leaking?! alt text http://www.freeimagehosting.net/uploads/d50bdb5dec.png

Ok, the problems could only come from here:

  • (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {

    DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"ProjectDetailView" bundle:[NSBundle mainBundle]];

    Project *project = [projectsArray objectAtIndex:indexPath.row];

    [detailViewController setProject:project];

    [detailViewController setTitle:[project name]];

    [self.navigationController pushViewController:detailViewController animated:YES];

    [detailViewController release];

}

OR from the detail view's viewWillAppear event:

  • (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    [projectName setText:[project name]];

    [appDefStatement setText:[project appDefStatement]];

    [projectDesc setText:[project desc]];

    NSMutableArray *theSketches = [[NSMutableArray alloc] initWithArray:[project.sketches allObjects]];

    [self setSketchesArray:theSketches];

    [theSketches release];

    if([sketchesArray count] == 0) {

    [tView setHidden:YES];  
    

    } else {

    [tView setHidden:NO];
    

    }

}

3
Post some of your code. Also, are you analyzing on the device? Sometimes, the simulator is not accurate.rickharrison
I am doing it on the device yes. The code is rather long and tedious :). But basically I am just using a TableView and a navigation bar as my root controller, then the user can select a cell that takes them to a detail view with two TextFields, a TextView and another TableView. If the user selects something in that table view, he is again sent to a detail view with a TextField and a TextView. I don't do anything spooky with those textfields and textviews, they just have a "changed" action attached that when triggered saves the data on the disk through Core Data.Marian Busoi

3 Answers

0
votes

Although is possible that somethings apple code has leaks, the fact that you see a leak there it doesn't mean that leaks is actually there. For instance, it could be that you alloc something from apple's framework and then you didn't release properly.

Hope this helps.

Greetings

1
votes

There are very few cases where the leaks come from Apple's source code, so I would say first things first:

  1. Anytime you use alloc you need to release whatever object you created at a later, safe time
  2. Make sure any objects that are synthesized in the .m file are released in dealloc call
  3. Read this helpful (albeit boring) article on memory management: http://developer.apple.com/iphone/library/documentation/cocoa/conceptual/memorymgmt/memorymgmt.html
  4. Walk through this great example on Leaks http://www.mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/

P.S. Without posting your code, we can only speculate... you'd get better answers by posting the suspect code.

0
votes

I think these are false leaks. One of the leaks even shows up for a line of code taken from Apple's documentation (the line from cellForRowAtIndexPath that attempts to fetch a reusable cell). So my guess is the Leaks instrument is not perfect. I have checked my code a number of times and made sure I am releasing everything that has been alloced/copied/retained/mutableCopied etc etc.