Note that there are some explanatory texts on larger screens.

plurals
  1. PONSAutoreleasePool drain releases +1 more than the number of sent autorelease messages
    primarykey
    data
    text
    <p>I've been having trouble debugging an iPhone app that crashes in a reproducible way.</p> <p><strong>Short story:</strong> A custom <code>UIViewController</code> is allocated and pushed onto a <code>UINavigationController</code>'s stack. Some time later the <code>UIViewController</code> is poped from the stack. The very next push of a <code>UIViewController</code> onto the stack crashes the app.</p> <p>The standard procedure for any crash is using the Instruments with <code>NSZombie</code> enabled. Upon inspection of the object's history some is revealed that I fail to understand:</p> <ul> <li>the object receives 2 (two) <code>autorelease</code> messages and</li> <li>the <code>NSAutoreleasePool</code>'s drain method send 3 (three) release messages</li> </ul> <p>So far, the only way to prevent crashes is to NOT send 1 (one) release message to the object in question and thus raising a red flag for memory leaks, only that it doesn't leak.</p> <p>Is there any other solution that I've overlooked?</p> <p><strong>Update:</strong> As one of you pointed out the obvious: </p> <blockquote> <p>You have a problem in your code. Nothing to do with autorelease pool drain.</p> </blockquote> <p>It turned out that the first <code>UIViewController</code> was passed as a delegate to the <code>UINavigationController</code> hence my confusion when the <code>Zombie</code> call was coming from the navigation controller itself. </p> <p>I should me more careful next time before asking the wrong question.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload