Re: Block Confusion...
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