Re: dealloc not beeing called... why?
Re: dealloc not beeing called... why?
- Subject: Re: dealloc not beeing called... why?
- From: Nathan Day <email@hidden>
- Date: Wed, 10 Jul 2002 01:14:39 +0930
Although strictly all objects that are retained should be released, some
are not, when you application quits instead of the AppKit going through
and releasing and eventually deallocating every instance, it just forget
about it since the memory of your applications process will be removed
when that process terminates (allocating and releasing of memory is
contained within this process), this makes quitting an application
quicker. Memory leaks are only a problem when it increases over time,
like if you keep creating objects which are not released, in some
situations there are a fixed number of objects created so it's not a
problem, like objects contained within you main nib. This does mean
though that if you try to do some other cleaning up in your dealloc
method, other than releasing object, it will not work. Instead you will
have to either implement the applicationWillTerminate: method in your
application delegate or listen for
NSApplicationWillTerminateNotification Notification somewhere else.
On Wednesday, July 10, 2002, at 12:04 AM, Development wrote:
OK, but I thought, the OS would care about the deallocation of the
object. It has the -dealloc method already built-in and whoever created
the instance of my subclasses NSObject after NIB load has to call this
-dealloc method eventually, no?!
If not, what's the right time and where's the right place to call the
objects -dealloc method, i.e. is there a recommended way to do this? I
have to do some clean up before quitting the app...
Maybe to intercept some kind of message?
Better subclass NSApplication instead of NSObject to have better
control over app runtime?
tia,
Dirk Stegemann
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.