• 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: "Erik M. Buck" <email@hidden>
  • Date: Mon, 6 May 2002 00:13:16 -0500
  • Organization: EMB & Assocites Inc.

----- Original Message -----
From: "Nathan Zamecnik" <email@hidden>
To: "Joel Rosenblum" <email@hidden>; <email@hidden>
Sent: Sunday, May 05, 2002 10:02 PM
Subject: Re: Retain, then autorelease and then release does what?


> > Also, I'd like a bit of clarification on one point: if I have a property
> > of a class which the class retains, when the class is released, will all
> > of its objects automatically be released as well, or must I explicitly
> > release each of them at that time?
> I think you get this terminology (property) from REALbasic. In Cocoa you
> would call it data member, member , member object or something similar.

It is an instance variable. Member is C++.

> Anyways, to answer your question 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];

Or [myObjectInstance autorelease]; BUT NOT BOTH

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

destructors are C++.. Objective-C has no such thing.

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

NO NO NO! You write a -(void)dealloc method. It is NOT normal to
override -release!

> Inside that method just simply give the release call to any object you
> allocated memory to.
> -- NAteZ
> _______________________________________________
> 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: Retain, then autorelease and then release does what? (From: Nathan Zamecnik <email@hidden>)

  • Prev by Date: Re: Cross Platform Obj-C?
  • Next by Date: Re: [OT] about Apache Folder; and graphics algorithms
  • Previous by thread: Re: Retain, then autorelease and then release does what?
  • Next by thread: Re: Retain, then autorelease and then release does what?
  • Index(es):
    • Date
    • Thread