Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Typically you unload a private property by assigning <code>nil</code> via the setter (e.g. <code>self.propertyName = nil</code>). Or you could set the ivar to nil after calling release, e.g. <code>[_propertyName release]; _propertyName = nil;</code>, but the former is preferable.</p> <p>The <code>didReceiveMemoryWarning</code> method is called when there is a low memory situation. It is called on every view controller, including the one(s) responsible for the currently visible UI!</p> <p>Therefore, you can't just unload data arbitrarily when you get a call to <code>didReceiveMemoryWarning</code> -- the view controller might need that data if it is currently visible on the display.</p> <p>The general principle is that <code>didReceiveMemoryWarning</code> can get rid of any resources it can to assist freeing up memory, but only those that aren't immediately needed. For example, in an OpenGL game you wouldn't unload textures that are currently visible on the display. However, see my last paragraph.</p> <p>Typically you reload the resources by checking they are loaded when you need them, and if not, loading them.</p> <p>It's not worth niling/releasing tiny resources such as a single normally sized string. You should concentrate on items taking up significant amounts of memory.</p> <p><strong>Recent advances in behind the scenes memory management mean you're less likely to need to actually unload data these days - the operating system can unload and reload uncompressed image data and the like behind the scenes.</strong></p> <p>As Hot Licks mentions, the simulator has an option for simulating a memory warning. It's worth triggering this memory warning at various points in your app to see how it behaves.</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