Releasing what's in an array?
Releasing what's in an array?
- Subject: Releasing what's in an array?
- From: Mark Dawson <email@hidden>
- Date: Fri, 25 Feb 2005 10:23:54 -0800
If I create a mutable array in my -init function:
self = [super init];
if (self) {
myArray = [[NSMutableArray allocWithZone:[self zone]] init];
}
return self;
Do I need to explicitly remove all pieces out the the array before releasing it in my dealloc routine?
[myArray removeAllObjects]; // is this step necessary?
[myArray release];
[super dealloc];
If I understand things, removing an object out of an array causes a release to happen (if there isn't a prior retain causing that object to be retained), so removeAllObjects would both remove and release all objects. However, does releasing the array itself have the same effect?
Thanks,
Mark
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden