Graphics Programs Reference
In-Depth Information
The
NSMutableArray
is pointed to by the local variable
items
within the
main
function, so the
main
function owns the
NSMutableArray
. Each
BNRItem
instance
owns the objects pointed to by its instance variables.
In addition, the
NSMutableArray
owns the
BNRItem
s. Recall that a collection object,
like an
NSMutableArray
, holds pointers to objects instead of actually containing them.
These pointers convey ownership: an array owns the objects it points to.
The relationship between pointers and object ownership is important for understanding
memory management in iOS.