My App tends to crash alot… 🙁
I know i’ve been making mistakes in deallocating the views and objects.. I just wanna knw apart from deallocating the memory in the last, how can i manage memory in between the code…
Also my most of the viewcontrollers uses -(void)ViewDidLoad to create the views..so shud i use -(void)ViewDidUnload too before deallocating the memory???
If yes, then plz guide me how to use it??
Also is there any other way to solve memory issues??? 🙁
Keep in mind that
viewDidLoadcan be called multiple times, this is especially true in low memory situations where view’s can be automatically unloaded to save memory.In this case you can either check if your object is nil before allocating it, or deallocate it in a memory warning (in
didReceiveMemoryWarning, ifself.view.superview == nilthen things will be automatically released).You should also get to know the profiling tools at some point, or at least the leaks profiler. In Xcode go to
Run -> Run With Performance Tool -> Leaks. There are some issues with this tool you might hit, but once you come to grips you’ll wonder how you lived without it (For instance if your host name has special characters in it you’ll need to rename it).