• 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
Re: dealloc not called?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dealloc not called?


  • Subject: Re: dealloc not called?
  • From: Raphael Sebbe <email@hidden>
  • Date: Sat, 9 Feb 2002 14:06:00 +0100

On Saturday, February 9, 2002, at 01:36 PM, Manfred Lippert wrote:

For example, in Apple's Sketch application, SKTInspectorController's -dealloc
method is never called.

I found the same problem these days in one of my apps:

I have an Custom NSView in my About-Box of my program. The dealloc method of
this Custom View is _never_ called. This is perhaps because the About-Box is
never destoyed once created and "lives" until the app quits. OK.


You could set the window to dealloc itself when closed in IB. You'd have to reload the About Box NIB each time then and that would cause (unneeded) allocations and deallocations.

But what makes me wonder: The awakeFromNib-Method for this Custom View is
called _twice_ when I open the About-Box!
Can anybody give me a hint why this happens?
I allocate some bitmaps in this method and because dealloc is never called,
I never free them and so they take twice the memory space as it needs to.
(Not to speak of CPU wasting for calculating a second bitmap.)


I can see 2 reasons:

- You load the NIB twice.
- Your custom NSView is the owner of another NIB (weird) than the one it is in, and thus also receives - awakeFromNib when that one is loaded.

Did you try setting a breakpoint in awakeFromNib ? That way you should be able to find out.

Raphael
_______________________________________________
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? (Now: NIB chaos ... ;-))
      • From: Manfred Lippert <email@hidden>
References: 
 >Re: dealloc not called? (From: Manfred Lippert <email@hidden>)

  • Prev by Date: Re: dealloc not called?
  • Next by Date: Re: Termination of threads.
  • Previous by thread: Re: dealloc not called?
  • Next by thread: Re: dealloc not called? (Now: NIB chaos ... ;-))
  • Index(es):
    • Date
    • Thread