Added garbage collection of derived objects.