|Nov 18, 2010, 09:44 PM||#1|
Multiple Windows and Memory Leakage
I've got an app with multiple windows that will often be opened for some time and then closed. So watching the memory usage of these windows and the window controllers is important to me. Here's the catch. I put an NSLog statement in the dealloc, which doesn't ever get printed in the console. I assumed that this meant that my window and window controller weren't being deallocated.
On the other hand, I just use the Leak Instrument on the app today. When I opened the second window, it shows 1 instance of my NSWindowController subclass, and when I close that window, it shows 0 instances of my NSWindowController subclass, and that no memory is being used by this class.
Don't these two observations contradict each other?
|Nov 19, 2010, 12:35 PM||#3|
I'm using garbage collection. I just didn't realize that it called something else instead of dealloc. Should I override finalize to make sure that it releases its internal objects?
|Nov 19, 2010, 01:45 PM||#4|
No. Reread the garbage collection documents. The point of finalize is NOT to duplicate the dealloc method. You should only clean up NON GC'd resources in the finalize method as a last resort. Even then, finalize is not necessarily guaranteed to be called.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|xCode and multiple windows||DennisBlah||Mac Programming||17||Dec 10, 2013 12:29 AM|
|Multiple Terminal windows||ChrisBedford||OS X 10.8 Mountain Lion||3||Aug 12, 2013 03:29 AM|
|Fullscreen with multiple windows||AquaMethod||OS X Mavericks (10.9)||2||Jun 24, 2013 10:22 AM|
|Now I get light leakage?||Bahroo||iPhone||17||Jan 3, 2013 12:24 PM|
|Multiple files/windows opening||Koll||Mac OS X 10.7 Lion||0||Nov 16, 2012 08:23 AM|
All times are GMT -5. The time now is 06:56 PM.