R Re: Bundle loading
R Re: Bundle loading
- Subject: R Re: Bundle loading
- From: Rainer Brockerhoff <email@hidden>
- Date: Thu, 22 Aug 2002 22:14:57 -0300
>
Date: Thu, 22 Aug 2002 11:24:27 -0700
>
From: Douglas Davidson <email@hidden>
>
>
The semantics of dynamically unloading bundles vary, just as the
>
semantics of loading bundles do. NSBundle does not support unloading,
>
but CFBundle does provided the underlying executable format does. For
>
example, MH_DYLIBs cannot be dynamically unloaded, but MH_BUNDLEs can.
>
Remember, though, that unloading of code is an inherently risky
>
operation; it is up to you to make sure there are no dangling pointers
>
to functions or data in the unloaded bundle. In many cases there is no
>
real need to unload a bundle--if the bundle's code is not executed, it
>
will simply page out over time, and no longer affect performance. Of
>
course, there are cases where explicit bundle unloading is necessary or
>
desirable, but it should be done with caution.
I have tried to investigate this for the case of loading and unloading NSBundle-based plug-ins. I gathered that, although NSBundle calls upon CFBundle, and CFBundle allows unloading for the executable format a NSBundle plug-in uses, the Objective-C runtime doesn't allow unregistering NSObject-derived classes.
There seems to be a call in the runtime for unregistering classes, but it's either unimplemented or buggy... I found a reference somewhere that NSBundles can't be unloaded "due to threading considerations", but no further explanation.
I'd really like to have a way of unloading plug-ins from my application, in order to load other ones - or perhaps even a new version of the same plug-in.
Douglas, do you happen to know if unloading NSBundles is simply impossible in the present runtime architecture, or if it's possible in principle but hasn't been implemented yet? In the second case, of course, I'm going to file a bug... but if it's impossible, I won't bother...
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"I love deadlines. I love the whooshing noise they make as they go by" (Douglas Adams)
http://www.brockerhoff.net/ (updated July 2002)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.