Re: Garbage Collection
Re: Garbage Collection
- Subject: Re: Garbage Collection
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 23 Jan 2008 08:56:58 -0800
On Jan 23, 2008, at 8:40 AM, Keith Duncan wrote:
When compiling with garbage collection supported, is the garbage
collection status determined at runtime or compile time?
The garbage collection options available in the Xcode build settings
window impact how the compiler generates code. So, yes, there is
impact at compilation time.
As far as I know it is decided when linking and the GC status is
based on whether the linked libraries support it or not. But take an
application which uses non-GC plugins for example, if all the linked
libraries DO support GC then the plugins which haven't been compiled
GC supported can't be loaded because they still depend on retain/
release logic.
No -- they can't be loaded because they do not have the correct hooks
-- the write barriers, in particular -- generated during compilation.
So, a GC supported app can't be deployed in an environment where it
will load non-GC supported plugins. Is there anyway to defer the
enabling of GC until all dynamically loaded code has been loaded?
From my knowledge of theoretical GC, it can be turned on at any
point in a reference counted environment; but once on it cannot be
switched off, is this correct? And if so, is there a low-level API
to perform such a task?
It doesn't make sense to write a dual mode application or tool. If
you need to support non-GC plugins, then maintain your code as a non-
GC application. It is an all or none proposition and, thus, trying
to support dual-mode isn't really going to help much for the efforts
of transition.
Since dynamically loading code always happens after some amount of
Objective-C code has been executed in your application and dynamically
loading code can easily trigger the execution of Objective-C code,
there is no way to selectively turn on GC at runtime; it needs to be
done at launch time.
b.bum
_______________________________________________
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:
This email sent to email@hidden