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: Re(2): Strange crash, CFBundle*



On Tuesday, December 11, 2001, at 11:23 AM, Dan Wood wrote:

Douglas, is this also the case with NSBundles? I'm currently working on a problem where I'm trying to completely deallocate an NSBundle (because the version on disk has been updated to a new version), and then load it again. Maybe this "unique-ing" is getting in the way. Any way to cause a bundle to be re-fetched from disk?

NSBundle does not support unloading, because there is not sufficient support in the Objective-C runtime to truly allow bundles to be unloaded. CFBundle does support unloading, provided that the underlying executable is of a kind that can be unloaded--for example, the main executable and Mach-o frameworks cannot be unloaded, but CFM plug-ins and Mach-o bundles can be unloaded.

If all references to an unloadable CFBundle are released, the bundle will be unloaded; there is also an API, CFBundleUnloadExecutable, which will immediately unload an unloadable bundle regardless of whether there are references to it or not, but you use it at your own risk. In any case, you must make sure that there are no outstanding pointers to symbols within a bundle before it is unloaded; at a minimum, any code that has such a pointer should maintain a reference to the bundle.

CFPlugIn has its own reference-counting scheme for instances, and if a CFPlugIn has no outstanding instances, and is dynamically loadable, then it will be unloaded--not immediately, but soon thereafter.

Douglas Davidson


References: 
 >Re: Re(2): Strange crash, CFBundle* (From: Dan Wood <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.