• 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: Block Confusion...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Block Confusion...


  • Subject: Re: Block Confusion...
  • From: Eeyore <email@hidden>
  • Date: Tue, 31 Jan 2012 17:42:04 -0800

On Jan 31, 2012, at 3:49 PM, R wrote:

> David,
> Class B is a parser.  It is passed NSData to parse (weak reference)
> and the Array (weak reference) from Class A.  The results of the Data
> parse are placed into the Array.  Class A will be around for the life
> of the application.  Class B will be released (set to nil) after
> completing the parse.
> I chose this approach rather than delegation.
>
> Thoughts?

I've been following skimming this thread and I think I would pass the NSData and the Array into the parser as strong references. It doesn't look like there is any chance of a cycle being created and the extra call to retain/release isn't an optimization to make until you start profiling. Even if you eventually decide to use weak references (after discovering the retain/release calls are a drag on performance), making them strong references now to see if that fixes the behavior can help you diagnose the problem. If strong references "solve" the obvious problem (the nil object), then you should question your assumptions about lifetimes of your objects.

Aaron
_______________________________________________

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: 
 >Block Confusion... (From: R <email@hidden>)
 >Re: Block Confusion... (From: Fritz Anderson <email@hidden>)
 >Re: Block Confusion... (From: R <email@hidden>)
 >Re: Block Confusion... (From: R <email@hidden>)
 >Re: Block Confusion... (From: David Duncan <email@hidden>)
 >Re: Block Confusion... (From: R <email@hidden>)

  • Prev by Date: Re: Block Confusion...
  • Next by Date: Re: Transparent window not getting mouse down events
  • Previous by thread: Re: Block Confusion...
  • Next by thread: Re: Block Confusion...
  • Index(es):
    • Date
    • Thread