On Sep 25, 2009, at 5:46 PM, Bob Barnes wrote:

Kyle/Nick/Greg,

Thank you guys. Took a little digging but the combination of NSZombie & instruments object allocation did the job. After years working with Java I find myself tripping over memory management issues much too often. I had allocated a UIButton using buttonWithType: and then later released it without ever having retained it. I'm concluding (perhaps incorrectly) that using buttonWithType: doesn't grant 'object ownership' in the same way that alloc does.

Right. Read the memory management guidelines; they outline the (simple) rules pretty well. Basically: You own the object if you receive it via a call that contains "new", "alloc", or "copy", in which case you *must* -release it. An object received via any other call, you do *NOT* own, and must *NOT* -release it unless you first - retain it.

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to