Reputation: 209
How do I decide when I should release memory? Because If I release the memory, many times the application crashes.
Upvotes: 1
Views: 138
Reputation: 882646
You should release memory when you've finished with it. Objects are reference counted so, as long as you retain
and release
(and everyone else does too), you should have no problems.
If you find you're crashing because you release the memory, then either you or someone else isn't following the rules.
In either case, find out who isn't following the rules, and fix it. Don't hold on to memory just to avoid crashes. That way lies madness (and lack of memory).
Upvotes: 3
Reputation:
Try the apple documentation on memory management in objective-c.
http://developer.apple.com/mac/library/documentation/cocoa/conceptual/MemoryMgmt/MemoryMgmt.html
Upvotes: 1