Re: releasing a object containing others in a array
Re: releasing a object containing others in a array
- Subject: Re: releasing a object containing others in a array
- From: Ken Thomases <email@hidden>
- Date: Sat, 3 Oct 2009 06:21:00 -0500
On Oct 3, 2009, at 3:10 AM, Nick Rogers wrote:
I have a class as following:
@interface NodeTypeOrph : NSObject {
int count;
ItemTypeOrph *key[4]; // Warning: indexing starts at 0, not 1
NodeTypeOrph *branch[5]; // Fake pointers to child nodes
}
when I'll send a release to an object of this type, will it
automatically release the arrays of ItemTypeOrph and NodeTypeOrph
objects.
Or do I have to explicitly traverse and release?
What's the rule for an object pointer instance variable that's not in
an array? Why would you expect the more complicated case to be easier
to handle?
None of your instance variables are automatically released for you.
You are responsible for overriding -dealloc and releasing all of your
instance variables (and anything else which is owned by your object,
if it's somehow stored in something other than an instance variable;
that is, you have to discharge your ownership responsibilities, no
matter the form they take).
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden