tags:

views:

52

answers:

4

I am trying to find good resource of book to learn more about memory management in Objective C. To be more exact I wonder when and how to use properly alloc, init, retain and/or copy on object, how it's managed, and released; besides what autorelease is and how to use it, when And why? how to handle this in simple methods to work with incoming argument.

Coming from Java this topic is kind of new one for me, and I am aware how bad memory management can create memory leaks, so I need to dig as deep as possible ;-) from the very beginning to understand.

+3  A: 

All you should ever need is covered in the Apple document: Memory Management Programming Guide for Cocoa

chpwn
Exactly what I just wrote :-)
VoidPointer
+1  A: 

I collected a few articles together in this blog post (note that links to Stepwise are now sadly defunct): http://iamleeg.blogspot.com/2008/12/cocoa-memory-management.html

Graham Lee
A: 

If you are coming from Java and you want to target the Mac/Cocoa, you might just want to use the garbage collector. This is not available on the iPhone though.

VoidPointer
A: 

This is a great document with the lowdown on memory management and other basics:

http://boredzo.org/cocoa-and-cocoa-touch-intro/

Rob Keniger