I wonder am I the only one who has trouble with the dealloc exercise in Chapter 3.
When I set the array ‘items’ to nil, the array gets destroyed but it seems that the contents (the BNRItems) do not and the BNRItem delloc method is not called.
Some experimentation shows that the problem seems to be related to the BNRItems being alloc-ed in the RandomItem Class method rather than in main().
If I create and alloc a BNRItem in main() it gets destroyed when the pointer is set to nil as you would expect but something seems to be retaining those objects alloc-ed in RandomItem.
By the way when the program terminates all the objects get destroyed and dealloc is called for all the BNRItems. I presume this is ARC tidying up when main is terminated but I can’t understand why setting items to nil doesn’t cause them to be destroyed. Surely items is the only owner?