So, to be a good memory-wise citizen:1. If there is only one outlet to a
top-level object from the nib owner, the outlet should have "assign"
attribute, and the nib owner is now in fact the "initial 1 retention"(which
seems reserved right for this predictable ownership)'s owner so is
responsible for the releasing. Otherwise if the outlet uses "retain" logic,
there will be a redundant retention to the top-level object so a memory
leak.
2. If there are other outlets to a top-level object from other objects, they
should use the "retain" logic to claim their share of ownership.
3. Outlets to non-top-level objects should always use the "retain" logic if
they want to claim their ownership, since there are no reserved initial
retain count for them.

Am I getting it all right?

On Wed, Oct 21, 2009 at 11:55 AM, Graham Cox <graham....@bigpond.com> wrote:

>
> On 21/10/2009, at 2:40 PM, an0 wrote:
>
>  Who owns the unarchived top-level objects' initial positive retain count?
>>
>
> Nobody. That's what "no owning object" means.
>
>  Are they retained for outlet connections?
>>
>
> No, because if there is an outlet to them then they are owned.
>
>  Or are they just not autoreleased only because they are top-level,
>> regardless of whether there are any outlet connected to them?
>>
>
>
> They are not autoreleased because that would presumably cause problems for
> the users of these objects, who don't own them either. If there's an outlet
> to them, they are owned by whoever declares the outlet.
>
> As it says, "Your code is responsible for releasing these top-level
> objects".
>
> This is not the big issue it seems. Most nibs don't contain top level
> objects with no owners. For the very few that do, the objects most likely
> leak but typically that's no big deal unless you're loading the same nib
> repeatedly many times.
>
> --Graham
>
>
>


-- 
Hell boy is cool, but let me be healthy boy first.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to