small medium large xlarge

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?


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.

03 Oct 2009, 04:52
Mauricio Giraldo (6 posts)


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


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!

06 Oct 2009, 21:32
Mauricio Giraldo (6 posts)


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

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.

06 Oct 2009, 23:28
Mauricio Giraldo (6 posts)


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.

07 Oct 2009, 02:09
Mauricio Giraldo (6 posts)

Reading this: 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.

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