My app(arc, ios5) sometimes will crash after I take a photo and save to CoreData
. Using Instruments I found that there are memory warnings before crash, so I tried to find out how memory is used.
My app stores trips in CoreData (totally 200MB), each trip has hundreds of CLLocation
objects and tens of UIImage
objects.
Each time I view one trip details by pushViewController, the memory usage grows up; but after I popViewController, the memory usage remains.
I think there are several suspects:
- the CoreData cache, but I don't know how to purge it;
- the detail view controllers, since I didn't see any viewDidUnload called after each popViewController;
After some tests, I was confused that even if I call viewDidUnload manually, the memory usage remains.
I also tested memory leaks instrument in ios5.0 simulator for my app, it's clean.