• 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: How To Design A Queue of Messages?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How To Design A Queue of Messages?


  • Subject: Re: How To Design A Queue of Messages?
  • From: Andreas Mayer <email@hidden>
  • Date: Sat, 10 Sep 2005 23:46:56 +0200


Am 10.09.2005 um 22:46 Uhr schrieb j o a r:

I personally wouldn't retain my targets in such an implementation,

For this specific problem I disagree.

The OP wanted to queue messages to send them some time later. In case you don't retain the target here, it might get deallocated before the message is sent - which will not only lead to an exception, but will leave the intended work undone.

As long as it is certain that the queue will be emptied, the target will eventually be released an so there's no risk of a memory leak. (You shouldn't rely on a specific object being deallocated at a specific time anyway, so there's no harm done by possibly delaying the deallocation of the target.)

(Also note, that in my sample code there are no explicit retain/ release messages. I'm using a dictionary to hold the target; dictionaries do retain stored objects automatically and release them as soon as they are removed. I just *love* Cocoa memory management. :))


Andreas _______________________________________________ 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: How To Design A Queue of Messages?
      • From: j o a r <email@hidden>
References: 
 >How To Design A Queue of Messages? (From: Jerry Krinock <email@hidden>)
 >Re: How To Design A Queue of Messages? (From: Andreas Mayer <email@hidden>)
 >Re: How To Design A Queue of Messages? (From: Frode <email@hidden>)
 >Re: How To Design A Queue of Messages? (From: Andreas Mayer <email@hidden>)
 >Re: How To Design A Queue of Messages? (From: Frode <email@hidden>)
 >Re: How To Design A Queue of Messages? (From: j o a r <email@hidden>)

  • Prev by Date: Cocoa Bindings Synchronization
  • Next by Date: Re: How To Design A Queue of Messages?
  • Previous by thread: Re: How To Design A Queue of Messages?
  • Next by thread: Re: How To Design A Queue of Messages?
  • Index(es):
    • Date
    • Thread