• 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: Deadlock during NSCache flush
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Deadlock during NSCache flush


  • Subject: Re: Deadlock during NSCache flush
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 21 Oct 2013 14:28:05 -0500

On Oct 21, 2013, at 2:11 PM, Jens Alfke wrote:

> Specifically, there is a “database” object that has a strong reference to an NSCache which maps to various ‘document’ objects (indexed by key.) The document objects have strong references back to the database.
>
> In the situation that hangs, there is a database with one document, neither of which have any external strong references to them. (They probably used to at one point, but the app stopped using that database.) That’s fine, it’s not a reference cycle because the NSCache will get cleaned up.

Seems like a cycle to me.  You can't rely on NSCache spontaneously evicting objects as the means for eliminating the cycle.  It might never do so.

In any case, it seems like the database owns the documents in the cache.  If nothing external has a strong reference to it – if "the app stopped using that database" – why should it keep existing even if the cache would clean it up "eventually"?

Have the documents hold weak references to the database.

Regards,
Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: Deadlock during NSCache flush
      • From: Seth Willits <email@hidden>
References: 
 >Deadlock during NSCache flush (From: Jens Alfke <email@hidden>)

  • Prev by Date: Deadlock during NSCache flush
  • Next by Date: Re: 3rd party executable in iOS project
  • Previous by thread: Deadlock during NSCache flush
  • Next by thread: Re: Deadlock during NSCache flush
  • Index(es):
    • Date
    • Thread