Re: Memory management with arrays
Re: Memory management with arrays
- Subject: Re: Memory management with arrays
- From: Bill Bumgarner <email@hidden>
- Date: Sat, 9 Feb 2008 23:02:27 -0800
On Feb 9, 2008, at 10:57 PM, ss2 cire wrote:
yay, one i THINK i can answer =)
I thought NSArray already automatically retained all objects that
were added to it?
then once the array is released (dealloced?) the objects within are
released as well
so you may only need to just send it an auto released object
so...
void foo()
{
[array removeAllObjects];
Bar *bar = [[Bar alloc] init];
[array addObject:bar];
}
that should work fine, shouldn't it?
please correct me if I'm wrong.
Double retain.
[array removeAllObjects]; // leaks the doubly-retained bar
b.bum
_______________________________________________
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