• 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: Bundle loading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bundle loading


  • Subject: Re: Bundle loading
  • From: Chris Ridd <email@hidden>
  • Date: Fri, 23 Aug 2002 14:37:49 +0100

Ondra Cada <email@hidden> wrote:
>
> On Thursday, August 22, 2002, at 07:00 , Chris Ridd wrote:
>
>> Marco was alluding to problems with +load earlier.
>
> +load is needed seldom enough. Unless you need some classes to poseAs
> their superclasses, or unless you need your bundle which is not supported
> by the application which loads it to initialize anyway, there is hardly
> any reason for it.
>
>> I can probably avoid using it, and instead arrange for initialization of
>> whatever object network I need in the (small number of) entry points in
>> my bundle. That shouldn't be too much of a hassle.
>
> If it is really so, the +initialize someone already has mentioned might
> be your real friend.

Right.

>> However what happens when the host exits? Do my objects get sent the
>> -dealloc message when the host (a CFM app in my case) exits and my bundle
>> gets "unloaded"?
>
> Alas here. Your bundle never gets unloaded, and no objects gets
> deallocated when app exits. Just the complete task memory gets freed, but
> its contents is never checked.

Not freeing memory is sort of OK but untidy - the OS is about to free the
pages very shortly anyway - but if I've got network connections etc open I
really do want to close them down cleanly.

> In Cocoa app, the proper place for exit cleanup is the
> NSApplicationWillTerminateNotification notification (or the appropriate
> delegate method, if any). For non-Cocoa apps, I'd guess the standard
> atexit (man atexit) is the way.

Hm. I'm not sure if this thing classifies as a Cocoa app or not. I mean,
the app's a Carbon one built using Codewarrior and a CFM binary and my
bundle's a "Cocoa" bundle (according to Project Builder) using gcc and a
Mach-O binary. Two almost completely different blobs of code glued together
by CFBundle.

I'll see if I get that notification or not.

> Of course if the application is killed the hard way, there's no way to do
> any cleanup at all (and I guess that's right).

As you say if the host gets killed all bets are off :-)

Cheers,

Chris
_______________________________________________
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.

References: 
 >Re: Bundle loading (From: Ondra Cada <email@hidden>)

  • Prev by Date: What does gdb's Unable to restore previously selected frame. mean?
  • Next by Date: Re: Icon classes?
  • Previous by thread: Re: Bundle loading
  • Next by thread: Equivalent to the fscanf() C function in Cocoa?
  • Index(es):
    • Date
    • Thread