views:

187

answers:

1

I would like to understand garbage collection in objective-c.

I know how to work with memory in C-like languages and in languages where I don't care about memory. But I don't understand when to use autorelease, retain, dealloc and everything else, so I get errors and memory leaks.

Could someone propose me a good tutorial to understand this all?

+3  A: 

Definitely start at the definitive source: Apple's Memory Management Programming Guide for Cocoa.

There's probably good discussion of this issue in most of the better Cocoa programming books, and elsewhere on this site, but that's where even those places will ultimately direct you.

Sixten Otto