Note that deletion is unconditional, regardless of whether other pointers to the Object are still in use (possibly within other Objects). A safer approach is to defer deletion, until all references to an Object have expired, by using AST_BEGIN/AST_END (together with AST_CLONE and AST_ANNUL if necessary).
AST A Library for Handling World Coordinate Systems in Astronomy