Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>There is no garbage collection feature. However, any object you <code>copy</code>, <code>retain</code>, <code>alloc</code> etc. has its retain count bumped up by one, and you are responsible for calling a <code>release</code>or an <code>autorelease</code> - you own an instance of that object. If you don't call <code>[&lt;YOUROBJECT&gt; release];</code> or <code>[&lt;YOUROBJECT&gt; autorelease];</code>, the object remains in the iPhone's/iPod Touch's/iPad's memory, but the pointer no longer remains, and a memory leak occurs, as that bit of memory can no longer be accessed. Autoreleasing adds the object to the autorelease pool, and means that it will become released at some point in the future. Always use a standard <code>release</code> where possible, as <code>autorelease</code> means that it will still stay in the device's memory for a while, you can never be sure when it will be released, and it is a slightly more demanding method to call.</p> <p>Never call <code>dealloc</code> on an object - releasing or autoreleasing is sufficient, and if required, the object will automatically be dealloced.</p> <p>Make sure you never release objects you do not own, and if you do release objects, you release them after you no longer have any use of them - otherwise, you may try to access that object, and the device cannot find the object, and the situation results in your app crashing due to an <code>EXEC_BAC_ACCESS</code> error - to find out the root of the problem, open Instruments, add the Object Allocation instrument and enable NSZombie detection in its preferences (or add the Zombies instrument (only available in iPhone SDK 3.2+)). You can then view the entire history of the object which causes the problem, and jump to the exact line of code that caused the problem.</p> <p>You can read more <a href="http://developer.apple.com/iPhone/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html" rel="nofollow noreferrer">here</a>.</p> <p>Hope this helped</p>
 

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