Hamish Rickerby

Menu

  • Home
  • Archives
  • Tags
  • About Hamish
  • RSS
December 13, 2008 By: <a href="/about">Hamish Rickerby</a>

Memory Management in Objective-C

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

  • Memory Management Blog Entry (iphonedevelopertips.com)
  • Memory Management Programming Guide for Cocoa (developer.apple.com)
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.

« Zazzle discount vouchers / codes Car tries to climb fence in Reading »

Copyright © 2023 Hamish Rickerby

Powered by Cryogen | Free Website Template by Download Website Templates