Dealloc Messages


#1

I am using Leopard - 10.6.8 with XCode Version 4.2 (Build 4C199). I am trying the program on assigning assets to employees and deallocating them. Both “dealloc” and “description” methods are overridden in the Asset and Employee class. When I run the program - I do NOT see any messages on deallocation at all.

I googled and then when I tried to force turning on ARC in the Apple LLVM Compiler Language section “Objective-C Automatic Reference Counting” - the project won’t build and gives the following error:

ld: file not found: /Developer/usr/lib/arc/libarclite_macosx.a
Command /Developer/usr/bin/clang failed with exit code 1

What settings do I need to use?


#2

Neither Leopard nor Snow Leopard can be used to compile code with ARC. You either have to adapt the code in the book to use older memory management schemes, get a Mac that has Lion, or ignore memory management for the purposes of this book, which should be ok, although this particular exercise won’t be useful.


#3

If you were on Lion - which is an awesome upgrade by the way and completely worth $29 - you’d see those wonderful messages. In the meantime, just be satisfied that there are a lot of those messages that pop up in roughly the order you’d expect, ie the objects are dereferenced in a sequential cascade based on when they lose their owners. And be thankful we no longer have to release every object we alloc by hand.