On Aug 6, 2011, at 3:06 PM, Jon Boone wrote:

> Is it dangerous to send the release message to p right after adding it to the 
> array?  Should I put the release at the end of the method?

You should release it when you're done with it. Granted, you can probably get 
away with it here, under a reasonable set of assumptions: employeeController 
actually retains it, rather than copying it, or just using it in the addObject 
method and not keeping a reference to it, and rearrangedObjects doesn't cause 
it to be released, and there's not some background thread that will modify 
employeeController and release it asynchronously.

But it would be a terrible habit to get in to. (Note how many assumptions it 
relies on...)

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to