Tag Archives: memory management

Memory management guidelines

In this post, I’ll outline four simple rules for memory management in Objective-C. The Apple docs have already established basic guidelines for object ownership, following the fundamental idea that if you own an object, then you’re responsible for releasing it. This post goes a step further with tips for when and where ownership can be […]

let it be

This post explains one of my favorite NSObject categories – one that is extremely universal and handy for shorter and, in my opinion, more memory-manageable code.  (Code below.) Edit: Commenter David found a bug in this implementation. Check out the fixed version here; the new source files are listed at the bottom of that post. (The […]

feeling retained?

This is a quick tip for figuring out why an object is not being released when you expect it to: For the object in question, override retain and release to log their activity. Don’t forget that alloc is always called first, so if you see an equal number of retain and release logs, this means […]