• 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: iOS: Preventing a singleton from being deallocated when the app is in the background.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iOS: Preventing a singleton from being deallocated when the app is in the background.


  • Subject: Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
  • From: Jens Alfke <email@hidden>
  • Date: Wed, 19 Oct 2016 14:18:33 -0700

> On Oct 19, 2016, at 2:14 PM, Jens Alfke <email@hidden> wrote:
>
> No, nothing would be dealloced. The whole process would just be killed

Sorry, I misspoke — I got it mixed up with termination for using too much memory.

If the app gets quit in the background it does get notified that it’s quitting and can clean up. But the singleton isn’t going to be dealloced. Not unless the Obj-C runtime has an on-termination task that nils out static strong object references, which seems like a silly thing to do because all it does is delay the process’s exit.

(C++ static destructors _do_ run on termination, but generally one tries to avoid having those, because they’re usually useless. There’s even a compiler warning for them.)

—Jens

_______________________________________________

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


References: 
 >iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Alex Zavatone <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Steve Christensen <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Alex Zavatone <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Jens Alfke <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Steve Mills <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Jens Alfke <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Doug Hill <email@hidden>)
 >Re: iOS: Preventing a singleton from being deallocated when the app is in the background. (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
  • Next by Date: Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
  • Previous by thread: Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
  • Next by thread: Re: iOS: Preventing a singleton from being deallocated when the app is in the background.
  • Index(es):
    • Date
    • Thread