Re: NSBundle unloading crash
Re: NSBundle unloading crash
- Subject: Re: NSBundle unloading crash
- From: Bill Bumgarner <email@hidden>
- Date: Fri, 29 Jan 2010 08:11:53 -0800
On Jan 29, 2010, at 4:09 AM, Jonathan Guy wrote:
> Thanks Greg. It was indeed a category issue but I seem to have fixed one problem and found another. If I load the first bundle, make a method call, then immediately unload, load the second bundle and make the same function call (all in the same event) I end up crashing when the autoreleas pool gets popped. If I do each in a separate event everything is fine. Am I right in assuming it is only the code that gets unloaded and no memory that has been initialised by methods in the bundle get freed when the bundle is unloaded i.e. is it safe for me to keep an NSDictionary around that has been passed back to me by a method in the bundle once it has been unloaded? (the dictionary contains only standard foundation kit objects). Also any other things to watch out for would be greatly appreciated.
Probably not safe and not because of the dictionary.
Namely, if your dictionary contains any keys or values that were constant strings defined in a bundle that has been unloaded, you will crash.
In short; unloading bundles is rife with sharp edges to the point of being effectively unsupported. You are far better off *not* supporting bundle unloading.
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