dealloc not called?
dealloc not called?
- Subject: dealloc not called?
- From: Eric Wang <email@hidden>
- Date: Sat, 09 Feb 2002 04:29:41 -0500
Hi,
I know this question has come up before but I wasn't able to find a
satisfactory answer. What I want to know is why an object's -dealloc
sometimes is not called. For example, in Apple's Sketch application,
SKTInspectorController's -dealloc method is never called. I tried setting a
breakpoint and inserting an NSLog in the dealloc method, but no matter what
I try -- closing the inspector window, closing the document window, quitting
the application -- I don't see -dealloc executed. It appears to do something
useful -- remove itself from the default notification center -- but why is
it never called?
I searched the list and I did find a plausible response which stated that
when an application quits, objects are not deallocated specifically, they
just get cleaned up with all the memory belonging to a program. However,
this leads me to wonder, why implement -dealloc at all then? If it is never
called, and program memory is automatically cleaned up when an application
is quit anyway, what's the point in implementing -dealloc?
Hopefully, someone more experienced than I can shed some light on this topic
for me. It has me thoroughly confused about memory management in Cocoa.
Eric Wang
_______________________________________________
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.