iOS Programming Vocabulary 3


I’ve been working through The Big Nerd Ranch iOS Programming Guide. There was a lot of new iOS terminology. It’s difficult to remember everything, so I created this quick reference. These terms are from Chapter 3 – Managing Memory with ARC.

Frame – Chunk of memory.

The Stack – Part of memory from which frames are allocated and destroyed.

ARC – Automatic Reference Counting
Automatic memory management. Takes care of destroying objects that are no longer pointed to.

Strong and Weak Reference – strong reference – variable owns the object. weak reference – variable does not own the object

Pointers – Variables point to objects. Variable owns object.

Heap – Where all Objective-C objects live. Pointers keep track of where objects are stored.

Memory Leak – Can be caused by strong reference cycle. Or when objects not properly destroyed.

Strong Reference Cycle – Objects pointing to each other. Objects can’t be destroyed. To fix, must make one of the references weak. Child should have weak pointer to parent. Parent should have strong reference to child. (since parent owns child)

Properties – Alternative to writing out accessor methods.

Multi-threading attribute – nonatomic or atomic. use nonatomic.

Read/write attribute – readwrite, readonly.

Memory management attribute – strong, weak, copy, and unsafe_unretained.
unsafe_unretained – Reference not automatically set to nil when object it points to is destroyed.
copy – Makes a copy of object to prevent changing original object. Used when property points to instance of a class that has a mutable subclass(like NSString/NSMutableString)

Dangling Pointers – When object that a reference points to is destroyed.

Synthesized properties – Properties are implicitly synthesized, meaning auto generated instance variable and accessor methods. They are explicitly synthesized with @synthesize.

Premature deallocation – Destroying an object that is still needed.

Autorelease – No need to concern with this. Back in the days of manual reference counting, when object was sent the message autorelease, the autorelease pool would take ownership of an object temporarily so that it could be returned from the method that created it without burdening the creator or the receiver with ownership responsibilities.