• 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 method needed?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dealloc method needed?


  • Subject: Re: Dealloc method needed?
  • From: email@hidden
  • Date: Tue, 25 Jun 2002 05:47:44 -0500

Of course in your -dealloc routine you should call its super dealloc..

- (void)dealloc
{
[ object release ] ;
...
[ super dealloc ] ; // standard obj-c pattern .. :-)
}


On Tuesday, June 25, 2002, at 02:51 AM, Andy Lee wrote:

At 9:11 AM +0200 6/25/02, Michhle Garoche wrote:
Le mardi 25 juin 2002, ` 08:32 , Nathan Day a icrit :
dealloc is called by the release method when the objects reference count reaches zero.
Excuse me. My words were not what I meant. I would say should I implement the release method...?

No. You should *call* -release at appropriate times (generally to balance calls to -retain), but never override it.

The reverse is true for -dealloc. You should *override* -dealloc if your object retains other objects, but never call it. As Nathan pointed out, it will be called implicitly when -release reduces the retain count to zero.

--Andy
_______________________________________________
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.

References: 
 >Re: Dealloc method needed? (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: Mutable class problems
  • Next by Date: Re(2): How to get notified on PPP connect/disconnect?
  • Previous by thread: Re: Dealloc method needed?
  • Next by thread: Re: Dealloc method needed?
  • Index(es):
    • Date
    • Thread