Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<ul> <li><p>Circular References. When objects are codependent, they will leak. You will need to mark some references as weak, and Instruments can help you locate these references. These leaks won't even show up as leaks because they hold strong references to each other.</p></li> <li><p>Create Autorelease Pools <code>@autorelease</code> to keep autorelease pool sizes down where you create many autoreleased objects (directly or indirectly). Specifically, your program and programs you depend on will <code>autorelease</code> many objects (ARC or otherwise). An autoreleased object is one which will be released "in the future". Every Cocoa program expects an autorelease pool to exist on each thread. This is why you create a new pool when you create a new thread, and why you create one in <code>main</code>. The pools operate as a stack - you may push and pop pools. When a pool is destroyed it sends its deferred <code>release</code> message to every object it holds. This means that really large loops with many temporary allocations may result in many objects which are referenced only by the pool, and the pool may grow very large. For this reason, you drain manage pools directly in some cases to minimize the number of objects that are waiting to be released and deallocated.</p></li> <li><p>Use proper bridging/casting. Sometimes you will need to manage lifetimes explicitly. ARC handles the obvious cases, but there are complex cases where you will need to manage lifetimes explicitly.</p></li> <li><p>When using <code>malloc</code>'ed and <code>new</code>'ed allocations, as well as opaque types in 'Core' APIs. ARC only manages <code>NSObject</code> types. You still need to explicitly free, delete, and use correct ref counting for these allocations, types, and when interfacing with those APIs.</p></li> <li><p>Always follow NS-API naming conventions, and <a href="https://stackoverflow.com/questions/7770872/deep-copy-of-dictionaries-gives-analyze-error-in-xcode-4-2/7770914#7770914">avoid explicit memory management attributes where possible</a>.</p></li> <li><p>You'll obviously need MRC when you compile sources without ARC or GC. This is quite common when using/working with other libraries/code bodies. Of course, the compiler handles interactions correctly so your ARC program should not leak.</p></li> <li><p>ARC handles <em>most</em> of what you will need if you use proper naming and written style, but there will be a few other corner cases. Fortunately, you can still run Leaks and Zombies to locate these issues if you don't realize them during development.</p></li> </ul>
 

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