Re: simple array release error question
Re: simple array release error question
- Subject: Re: simple array release error question
- From: sinclair44 <email@hidden>
- Date: Sat, 31 May 2003 19:32:05 -0400
On 5/31/03 7:18 PM, "Ben Dougall" <email@hidden> wrote:
>
array doesn't seem to exist when [array release] is called in the
>
second one. why is it different to the first version?
An array retains all the objects you insert into it. When you release each
object in the loop in the second example, the array keeps a reference to it.
Then, when you release the array, it trys to re-release the objects, causing
the signal 11. Remember, don't release memory you haven't allocated, and
don't release it more than once; that's the only way this could come about!
The first example does not suffer from this problem because the array no
longer references the objects when you release it, because they are removed
from the array's internal list when you call -removeAllObjects.
_______________________________________________
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.