Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Garbage collector vs variable lifetime



On Fri, Jun 6, 2008 at 11:48 PM, Bill Bumgarner <email@hidden> 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.

>From http://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?

Hamish
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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/email@hidden

This email sent to email@hidden

References: 
 >Garbage collector vs variable lifetime (From: Quincey Morris <email@hidden>)
 >Re: Garbage collector vs variable lifetime (From: Bill Bumgarner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.