Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

objective-c singleton memory deallocation

Should I somehow release shared object (on which singleton is based) when my application terminates if no garbage collector used (iPhone environment)?

like image 782
kpower Avatar asked May 17 '10 09:05

kpower


2 Answers

When an application exits, all its memory is released. So it really does not matter if you release objects at all, so long as you don't use too much memory while running.

Even when the strategy changes in 4.0, a single small object won't have much impact; it will still be released along with the rest of the application when it terminates.

like image 155
Paul Lynch Avatar answered Sep 23 '22 01:09

Paul Lynch


As an aside, you might find this useful:

http://cocoawithlove.com/2008/11/singletons-appdelegates-and-top-level.html

like image 45
Ryan H. Avatar answered Sep 24 '22 01:09

Ryan H.