Implementing a garbage collector for hierarchical resources...