On Jun 6, 2008, at 4:18 PM, Hamish Allan wrote:
On Fri, Jun 6, 2008 at 11:48 PM, Bill Bumgarner <[EMAIL PROTECTED]> wrote:
The garbage collector does not currently interpret inner pointers as
something that can keep an encapsulating object alive.
But it's not the inner pointers I would expect to keep the object
alive -- it's the fact that stack variables are root objects, and that
NSData *data is still in the current stack frame.

Fromhttp://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcEssentials.html
:

"The initial root set of objects is comprised of global variables,
stack variables, and objects with external references. These objects
are never considered as garbage. The root set is comprised of all
objects reachable from root objects and all possible references found
by examining the call stacks of every Cocoa thread."

If the optimising compiler is marking variables past a certain point
in the code block as being collectable because it doesn't think
they're going to be used again before the stack frame is popped, this
should be made explicit in the documentation (perhaps it is but I
missed it).

And is it really that important of an optimisation to make, if it's
going to have side effects like this?

Yes, it is an exceedingly important optimization. Most likely, that stack slot is being reused by some variable later on.

I filed a bug asking that particular doc to be clarified-- <rdar://problem/5993075 >-- I can't remember if it is mentioned anywhere else, but it should definitely be mentioned there!

b.bum




Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to