• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: unloading bundled class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unloading bundled class


  • Subject: Re: unloading bundled class
  • From: Stefan Arentz <email@hidden>
  • Date: Fri, 18 May 2001 10:42:40 +0200

On Friday, May 18, 2001, at 02:54 AM, Andreas Wolf wrote:

> Hi,
>
> Thanks for all the helpful answers to my previous questions.
> Here is another one:
>
> Is there a save way to get rid of all of a bundle's allocated memory?
> (Just as if you'd quit the bundle).
>
> I have a:
>
> bundle=[NSBundle bundleWithPath::[[NSBundle mainBundle]
> pathForResource: componentName ofType::@"bundle"]];
>
> if(componentClass=[bundle principalClass])
> {
> componentInstance = [[componentClass alloc] init];
> [componentInstance show:nil];
> // .. do things with componentInstance
> }
>
>
> Now, it figures that I could get rid of the bundled componentInstance
> by releasing it.
>
> [componentInstance release];
> componentInstance = nil;
> However, top shows that I don't really get rid of all allocated memory,
> since the size of my program increases everytime I load the bundle and
> never actually decreases (although I know that the componentInstance
> gets the release message.

You could try wrap the above code in a NSAutoreleasePool, that way you
can control the time when the autoreleased objects are freed. There's an
example in the NSAutoreleasePool I think.

Also, what might be happening here is that the Objective C runtime
cannot unload the class. I'm not familiar with the details of the
runtime, but there's a good change that it cannot unload classes.

Stefan


References: 
 >Re: unloading bundled class (From: Andreas Wolf <email@hidden>)

  • Prev by Date: Menu bar
  • Next by Date: Re: Property List Question
  • Previous by thread: Re: unloading bundled class
  • Next by thread: Re: unloading bundled class
  • Index(es):
    • Date
    • Thread