IOS 5 + ARC - Assign nil to free pointer memory?

I am trying to follow Apple's recommendations on how to respond to low memory alerts in my application. The recommendations say: "Upon receipt (low memory warning), your application should free up as much memory as possible, freeing up objects that it does not need, or clear memory caches that it can recreate later."

The question is how to “free” memory using ARC?

For example, suppose I have an image in a hierarchy of views that does not appear on the screen. In didReceiveMemoryWarning, I am currently removing it from the view by calling removeFromSuperview, but I still have a pointer to the UIImage itself. Should I also try to free this memory? How? By assigning nil to a pointer?

TIA: John

+5
source share
2 answers
  • When you receive -didReceiveMemoryWarning, your presentation should be automatically released by the system and -viewDidUnloadshould be called. Therefore, if you do not keep links to subviews of the submission, you are not responsible for releasing them.

  • , , , , "nil" NSObject s, , , CFRelease Core Foundation.

+3

IBOutlet strong.

IBOutlet nil viewDidUnload.

0

All Articles