• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
dealloc not called?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: dealloc not called?
      • From: Manfred Lippert <email@hidden>
    • Re: dealloc not called?
      • From: Raphael Sebbe <email@hidden>
  • Prev by Date: Re: Termination of threads.
  • Next by Date: Re: dealloc not called?
  • Previous by thread: Anti-aliased fonts
  • Next by thread: Re: dealloc not called?
  • Index(es):
    • Date
    • Thread