RemoveObjects

RemoveObjects[class]
removes all objects listed by Objects[class], while RemoveObjects[class, All] also includes objects of all subclasses. Scan[RemoveObjects, Descendants[Object]] removes all objects (RemoveObjects[] is not defined in order to avoid accidential removal).
This loads the package.
In[1]:=
Click for copyable input
Let us first create a simple base class and a child class.
In[2]:=
Click for copyable input
This generates some objects.
In[3]:=
Click for copyable input
The objects are held in a list and can be removed without holding explicit references. The last line also lists the objects that have the given class as superclass.
In[4]:=
Click for copyable input
Out[4]=
Out[4]=
Out[4]=
Out[4]=
The next example recreates some base objects and includes all subclasses
In[5]:=
Click for copyable input
Out[5]=
Out[5]=
Out[5]=