• 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: [NSConnection release] anxiety
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSConnection release] anxiety


  • Subject: Re: [NSConnection release] anxiety
  • From: Frank Midgley <email@hidden>
  • Date: Thu, 5 May 2005 15:52:06 -0500

On May 4, 2005, at 7:49PM, Andy Lee wrote:

On May 4, 2005, at 8:25 PM, James Bucanek wrote:

My main problem is the lifetime of the NSConnection object itself.  Everything else pretty much takes care of itself, but I can't determine a definative time when the NSConnection object can be released.

If I let my application leak NSConnection objects, it works fine.  ;)

If no one can come up with an answer to this, I might end up creating an NSConnection pool/factory and do some "lazy" garbage collection.


This sounds like a candidate for one of the -performSelector... methods in NSObject, with a delay of 0.  Delayed performs are good for cases when you:

(a) can't send the message you want to send (like -release) right this moment, because

(b) you're in the middle of something (like using the object you would be releasing), but

(c) you want to send the message just as soon as you're done with that something.

Your idea of a NSConnection pool would essentially be a hand-rolled version of delayed performs.

We initially did this for invalidating connections and started getting dozens of unreproducible crash reports from end users.  You'll see things like NSPortDeathNotify in the stack traces if you start to run into this problem.  After a large effort we were never able to come up with a reliable way to close a connection from within a DO call over that connection.  We ended up having to slightly re-architect our threading code so that connections were managed better and did not need to be closed during the DO calls.  All crashes went away at that point.


Your mileage may vary...


-Frank


------------------------------------

Frank M. Midgley

email@hidden

http://homepage.mac.com/knarf/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: [NSConnection release] anxiety
      • From: James Bucanek <email@hidden>
References: 
 >Re: [NSConnection release] anxiety (From: James Bucanek <email@hidden>)
 >Re: [NSConnection release] anxiety (From: Andy Lee <email@hidden>)

  • Prev by Date: using NSSavePanel for directories (not files)
  • Next by Date: NSOutlineView problem
  • Previous by thread: Re: [NSConnection release] anxiety
  • Next by thread: Re: [NSConnection release] anxiety
  • Index(es):
    • Date
    • Thread