On Aug 13, 2012, at 09:01 , Kyle Sluder <k...@ksluder.com> wrote:

> As was discussed on the objc-language list recently, the ARC spec 
> specifically guarantees that an object's lifetime includes the entire 
> duration of a method invocation. An object *cannot* be deallocated while one 
> of its methods is executing.

That was only under the assumption that the receiver's pointer was loaded from 
a weak variable.

It'll also be true if the receiver's pointer is loaded from a strong stack 
variable (because the stack reference's lifetime cannot end before the 
receiver's method is called -- even under optimization -- and there isn't 
AFAICT any subsequent way for it to end until the receiver's method returns).

However, if the receiver's pointer is loaded from a *strong* instance variable, 
there's no memory management applied to it. It's not retained when loaded 
(which I just verified by looking at a disassembly), and it's not retained on 
entry to the method itself (the Clang ARC spec explains why not). Setting the 
strong ivar to nil during the method execution would be a really bad idea.

At least, that's how I understand the situation.




_______________________________________________

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

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

Reply via email to