small medium large xlarge

Steve_passport_pragsmall
07 Mar 2009, 08:05
Steve Fogel (20 posts)

Hi, all…

I’m puzzled by this situation. Seems like an object that I should release is causing trouble when I do.

Here's the code:
- (IBAction)doAdd:(id)sender {
     ItemAddController *theItemAddController = [[ItemAddController alloc] initWithStyle:UITableViewStyleGrouped];
     [self.navigationController pushViewController:theItemAddController animated:YES];
     [theItemAddController release];
}

If I leave the 3rd line in, where I release the object, I get this debugger message when popping the view off the nav stack:

-[CALayer retainCount]: message sent to deallocated instance 0x564d20

What’s going on?

Thx

Biopic_100x100_pragsmall
08 Mar 2009, 03:39
Bill Dudney (917 posts)

Hi Steve,

Well with the little bit I ahve to go on its very difficult to diagnose.

What is 0x564d20? Have you looked at it in the debugger? Have you turned on Zombies to see what its class was if you can’t tell at the point of crash?

This message means that a freed instance of CALayer is being sent ‘retainCount’.

I want to help but I need more information.

Generic-user-small
03 Oct 2009, 04:52
Mauricio Giraldo (6 posts)

Hi

How do you know what instance/object a given hex value corresponds to?

Thanks

Biopic_100x100_pragsmall
03 Oct 2009, 10:24
Bill Dudney (917 posts)

Hi Mauricio,

You can use po to print the object. On the GDB command line;

po 0x564d20

if its not a freed object then you should get the description of the object printed on the console.

Good luck!

Generic-user-small
06 Oct 2009, 21:32
Mauricio Giraldo (6 posts)

Thanks.

I guess the object would still be “alive” if I have zombies enabled. Right?

Biopic_100x100_pragsmall
06 Oct 2009, 21:53
Bill Dudney (917 posts)

the object is still ‘alive’ but its class is changed to a zombie class

hope this helps.

Generic-user-small
06 Oct 2009, 23:28
Mauricio Giraldo (6 posts)

thanks

if I were looking for a CALayer that is getting released when it has been already deallocated (-[CALayer release]: message sent to deallocated instance 0x1922470), how would you suggest that I find out which object is receiving thhis? My app runs fine, no leaks, Clang Static Analyzer is OK but I am stress-testing by simulating a memory warning in a specific point (memory warnings in other places have no trouble).

This specific view is a flip modal view. I put a breakpoint in didReceiveMemoryWarning and “step in” a million times until I get to the crash but no helpful information.

Generic-user-small
07 Oct 2009, 02:09
Mauricio Giraldo (6 posts)

Reading this: http://stackoverflow.com/questions/1314442/program-crash-upon-switching-between-tabs-5-times I noticed the user has a custom table cell. I am actually using a TableView with custom cells (based on your video tutorial) nested inside another (main) view. The main view is itself the modal view. Would this be related to the user’s issue? The cell is loaded this way:

	StatTableCell *cell = (StatTableCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        [[NSBundle mainBundle] loadNibNamed:@"StatTableCellView" owner:self options:nil];
		cell = self.statCell;
    }

I am only getting problems when invoking a manual memory warning.

Generic-user-small
07 Oct 2009, 05:37
Mauricio Giraldo (6 posts)

Finally figured it out!

Well I did not know that you should nil out IBOutlets in didReceiveMemoryWarning. This brings the trouble that the flipped view now goes away in lack of memory, but is generated on-demand when the flip-back ends.

It would be good to have it reappear before the flipback so there is no “flicker” when going back to the main view after a memory notification.

You must be logged in to comment