• 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: Retain, then autorelease and then release does what?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retain, then autorelease and then release does what?


  • Subject: Re: Retain, then autorelease and then release does what?
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 6 May 2002 13:50:53 +0200

On Monday, May 6, 2002, at 05:02 , Nathan Zamecnik wrote:

anytime you create an object like :
MyObjectInstance = [[myObject alloc]init];

It is your job to at some time make sure that object is sent:
[myObjectInstance release];

Right.

That is why in any class you make you write a method called a destructor.

Right, though the name "destructor" is not generally used in ObjC/Cocoa.

You do this simply by make an class method called -(void)release;

Wrong: the method is called "dealloc". You, as a newbie, NEVER EVER reimplement release.

Inside that method just simply give the release call to any object you
allocated memory to.

Plus any object you retained (minus any object you released before, but that's obvious).
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
2K Development: email@hidden http://www.2kdevelopment.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: Retain, then autorelease and then release does what? (From: Nathan Zamecnik <email@hidden>)

  • Prev by Date: Re: Write to a text file
  • Next by Date: [sort of OT] PackageMaker help
  • Previous by thread: Re: Retain, then autorelease and then release does what?
  • Next by thread: Accessing window in document applications
  • Index(es):
    • Date
    • Thread