Note that there are some explanatory texts on larger screens.

plurals
  1. POXcode and ARC debugging issue (skipping dealloc)
    primarykey
    data
    text
    <p>I have spent some time debugging a weird issue with ARC and custom dealloc functions.</p> <ol> <li>I'm subclassing <code>NSOperation</code> class</li> <li>I set completion block for this operation</li> <li>The operation is referenced by a strong property of <strong>very</strong> flat object (no methods, automatic ivars, two strong properties) lets call this object <code>DataRequest</code></li> <li>following all guidelines the completion block uses only weak references to local objects (including the operation itself)</li> <li>neither compiler nor analyzer generate any issues</li> <li><code>DataRequest</code> holds the ONLY reference to the operation I generate and is destroyed in the operation completion block. It's ALWAYS destroyed (its <code>dealloc</code> always executed)</li> <li>My operation has a custom <code>dealloc</code>. I have only a single NSLog call in it.</li> </ol> <p>... and the issue is:</p> <p>If I run this under in debugger, the breakpoint in the dealloc is never hit, the log message never appears. Primarily I thought the operation was leaking.</p> <p>If I run this in instruments, all is fine, the system console prints the message and Allocations instrument reports the operation being freed from the proper stack snapshot including the custom dealloc. No leaks detected.</p> <p>I'm 100% sure I use the same compiler settings for debugging and for profiling.</p> <p>The most confusing thing at the end: If I create a custom version of <code>[DataRequest dealloc]</code> and I put <code>self.operation = nil;</code> to it - all works fine even from the debugger.</p> <p>Does anybody have some hints what compiler linker options to try to see some difference? can this be bug in Apple tools (all of us were in the position blaming a big fish for our own errors, right?)</p> <p>... and yes I have tried with GDB and LLDB. Result was the same - what might indicate something.</p> <p>I have tried to create a minimalistic sample but it just worked (indeed) ;)</p> <p>Thanks</p>
    singulars
    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.
 

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