Re: String memory leak
Re: String memory leak
- Subject: Re: String memory leak
- From: "Chris Lewis" <email@hidden>
- Date: Mon, 3 Apr 2006 01:51:48 +0100
Hi Paul,
You're right, I had gotten myself confuzzled on a lack of sleep and
abortive Red Bull kickstart. I suck. My apologies everyone.
When I was a newbie (rather than my current inept semi-newbie status)
I wasn't really sure the deal with Cocoa array retainment strategys.
As part of the Cocoa framework methodology, they work entirely as you
would think. If you don't entirely see that methodology through yet,
they can appear a little tricksy.
It seems strange that this:
SomeObject *object = [[SomeObject alloc] init];
[array addObject:object];
[object release]; // container now "owns" object we are done with
is valid. I would have seen this as the array having a pointer to an
object I just happily released, and now have no guarentee of it's
existance. But yes, the array retains the object for itself until it's
removed or the array itself is released.
Of course, this is all valid and totally correct and expected
behaviour. It's just a little new if you have thought of arrays with
objects in soley as a way of storing a lot of object pointers at once.
Chris
_______________________________________________
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