in reply to Deallocating HASH pointer

Just delete the tree, unless you have circular references (e.g. child nodes have a reference to the parent).