How to implement didReceiveMemoryWarning ?

Posted by hib on Stack Overflow See other posts from Stack Overflow or by hib
Published on 2010-03-12T05:41:27Z Indexed on 2010/03/12 5:47 UTC
Read the original article Hit count: 493

Filed under:
|

Hello all ,

I have developed a simple location aware iPhone application which is functionally working very well to our expectations except in the low memory condition of the phone .

In low memory condition of the phone my app just got crashes and If I increases the phone memory by freeing up some space it again start working well without any crash .

when I do some googling on the problem I found that in the low memory conditions the os will send didReceiveMemoryWarning to all the controllers in the current hierarchy so that each one of them should implement didReceiveMemoryWarning method and also set nil to iboutlet for the view that is currently not visible .

I have also read somewhere that if the view for that controller is not visible the method setView with nil parameter will be called and if there are some outlet variables attached to view there will be problem in removing them.

So with all these fundas what is the best to handle low level memory condition raised by the Iphone by implementing the didReceiveMemoryWarning and viewDidUnload methods.

Please give a proper example or link if possible for the solution of the above problem .

thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory-management