The Apple Advanced doc for memory management is pretty well written and accurate, but I wonder what diagram it has:
(my current edition is 2011-09-28)

In the diagram after alloc, initthe reference counter (or the saving account) is 1, which is the main rule for managing memory. After, retainthe reference count is now equal to 2. And then class C sends a message to this object copy, and after that the object still has reference count 2. The new object has reference count 1.
This has so far been consistent with the rules, but then, at the top of the diagram, class A sends a message to the releaseobject, and the reference count should be 1? The chart has 2 instead. Then class B also sends a message to the releaseobject, and the reference count should now be 0. Instead, it displays 1. Is this correct, or maybe there is another way to read the diagram, or maybe some concept is incorrect above?
source
share