A destructor is guaranteed to be called. Perhaps you're thinking of another language with a focus on garbage collection.