Hamish Rickerby

Technology Consultant & iOS Developer based in Sydney, Australia

Memory Management in Objective-C

| Comments

I was having some issues with Memory Management and dealloc’ing objects (and subsequently crashing software) and found the following resources very useful:

To paraphrase
  1. Never dealloc, use release
  2. If you create an object it’s your responsibility to release it
  3. If you want to own an object or use and object returned from another object you should retain it
  4. Don’t release an object you didn’t create or own
Now I remember why I like programming languages that take memory management out of my hands. Last time I touched memory management was at university, and it was a pain then too.
Good thing is that Objective-C/Cocoa has those simple rules/conventions to follow. ¬†Memory Management is not onerous on the mac/iPhone, so I can’t complain too much.

Comments