AbeAndrewsDEV AbeAndrewsDEV - 1 year ago 148
iOS Question

Memory Warning in Xcode - What does one do in didReceiveMemoryWarning?

I have asked this before but I think my question was not understood, so here goes again:

We do not handle memory anymore, since ARC does that. We cannot even invoke memory release commands etc.. So what CAN one do programmatically at RUN TIME to address a memory warning issue if the delegate receives the memory warning notification?

I do NOT want to know how to fix my code!!!
Code cannot fix itself at run time.

Assuming I have coded correctly, BUT still receive a memory warning, what can be done ..

ie Can you give an example of what to code into the

- (void)didReceiveMemoryWarning
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.


Answer Source

Of course you still have control over memory. You're just operating at a higher abstraction level with ARC.

You can use: object = nil to clear a strong reference. When all strong references are cleared, the object is deallocated.

If you are familiar with manual reference counting:

object = nil; << ARC

is like this when doing your own reference counting:

[object release], object = nil;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download