FROM : Dirk van Oosterbosch
DATE : Mon Apr 18 23:36:19 2005
FYI
On second thoughts,
I guess it is not that strange behavior of NSBundle to not want to
release, since you also cannot unload code that is loaded with a
bundle. (And using bundles as a document format is not exactly what
it's build for, I presume).
> But what are my alternatives?
Well, NOT use a NSBundle, I decided.
I figured out in the end I only used its -objectForInfoDictionaryKey to
get to its Info.plist. So I now I am just loading the xml Info.plist
from file and putting its contents in a NSDictionary. Job done.
dirk
On 18-apr-05, at 15:28, Dirk van Oosterbosch wrote:
> Hi all,
>
> I am witnessing a strange behavior with the (not) release of NSBundle.
> It seems it doesn't want to be released, period. No matter how many
> -release(s) you send it.
>
> I am using
> [self setBundle:[NSBundle bundleWithPath:bundlePath]];
>
> and the accessor method
> - (void)setBundle:(NSBundle *)aBundle
> {
> [aBundle retain];
> [bundle release];
> bundle = aBundle;
> }
>
> But the [self setBundle:nil]; from my -dealloc doesn't actually
> release it.
>
> I am using this NSBundle as my document base type (meaning my
> NSDocument-subclass owns a MyOwnBundle instance -from which the code
> above stems- which owns a NSBundle). But everytime I open / close /
> open / cl... the same document, I am seeing the first state of that
> document, regardless of whether I changed it behind the applications
> back. I am NSLogging the bundle's -retaincount and every time I set
> the bundle using the above +bundleWithPath method, and using the same
> bundlePath, I see my retain count explode: 8, 32, 128, 384, 640, 896,
> 1152. This can't be right.
>
> in this old thread
> http://www.cocoabuilder.com/archive/message/cocoa/2001/11/24/43545
> Ondra Cada says "rather, unless you really need to do that,
> don't retain the result of bundleWithPath"
> Well, I guess I am. But what are my alternatives?
> Are there other things I should do to get the bundle? Or are there
> alternatives to releasing it?
>
> Thanks,
> Dirk van Oosterbosch
>
>
>
> -----------------------------
> Dirk van Oosterbosch
> de Wittenstraat 225
> 1052 AT Amsterdam
> the Netherlands
>
> T ++ 31 20 7765565
> M ++ 31 6 48401910
> W http://labs.ixopusada.com
> -----------------------------
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Mon Apr 18 23:36:19 2005
FYI
On second thoughts,
I guess it is not that strange behavior of NSBundle to not want to
release, since you also cannot unload code that is loaded with a
bundle. (And using bundles as a document format is not exactly what
it's build for, I presume).
> But what are my alternatives?
Well, NOT use a NSBundle, I decided.
I figured out in the end I only used its -objectForInfoDictionaryKey to
get to its Info.plist. So I now I am just loading the xml Info.plist
from file and putting its contents in a NSDictionary. Job done.
dirk
On 18-apr-05, at 15:28, Dirk van Oosterbosch wrote:
> Hi all,
>
> I am witnessing a strange behavior with the (not) release of NSBundle.
> It seems it doesn't want to be released, period. No matter how many
> -release(s) you send it.
>
> I am using
> [self setBundle:[NSBundle bundleWithPath:bundlePath]];
>
> and the accessor method
> - (void)setBundle:(NSBundle *)aBundle
> {
> [aBundle retain];
> [bundle release];
> bundle = aBundle;
> }
>
> But the [self setBundle:nil]; from my -dealloc doesn't actually
> release it.
>
> I am using this NSBundle as my document base type (meaning my
> NSDocument-subclass owns a MyOwnBundle instance -from which the code
> above stems- which owns a NSBundle). But everytime I open / close /
> open / cl... the same document, I am seeing the first state of that
> document, regardless of whether I changed it behind the applications
> back. I am NSLogging the bundle's -retaincount and every time I set
> the bundle using the above +bundleWithPath method, and using the same
> bundlePath, I see my retain count explode: 8, 32, 128, 384, 640, 896,
> 1152. This can't be right.
>
> in this old thread
> http://www.cocoabuilder.com/archive/message/cocoa/2001/11/24/43545
> Ondra Cada says "rather, unless you really need to do that,
> don't retain the result of bundleWithPath"
> Well, I guess I am. But what are my alternatives?
> Are there other things I should do to get the bundle? Or are there
> alternatives to releasing it?
>
> Thanks,
> Dirk van Oosterbosch
>
>
>
> -----------------------------
> Dirk van Oosterbosch
> de Wittenstraat 225
> 1052 AT Amsterdam
> the Netherlands
>
> T ++ 31 20 7765565
> M ++ 31 6 48401910
> W http://labs.ixopusada.com
> -----------------------------
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Dirk van Oosterbos… | Apr 18, 15:28 | |
| Dirk van Oosterbos… | Apr 18, 23:36 | |
| Gen Kiyooka | Apr 19, 06:48 |






Cocoa mail archive

