[Fix] ClassBuilder (Obsolete Classes)

Nathanael Scharli n.schaerli at gmx.net
Wed Apr 24 11:53:39 UTC 2002


Hi Tim

> > *** After cleaning up ***
> > Really obsolete metaclasses: 63
> > Really obsolete classes: 63
> It's hard to imagine that there should be any obsolete classes left,
> wonder what is still keeping them around? Definitely some cleanup
> needed.

Well, that depends on what you mean by 'obsolete classes'. In Squeak, an
obsolete class is a class that has been removed from the namespace, but is
still referenced and can therefore not (yet) be garbage collected. Such a
reference can be a reference from a subclass, a reference from an instance,
a reference from a method, etc.

As an example, just do the following:

1) Create a new class A as a subclass of Object
2) Create a new class B as a subclass of A
3) Delete the class A (ignore the warning that A has subclasses)

And what you just did is "creating" a new obsolete class! The class A is
removed from the namespace, but it is still needed because it is the
superclass of the non-obsolete class B. If you look at the definition of B,
you see that its superclass is actually called 'AnObsoleteA'. And if you did
that in your recent image, you would now have 64 (instead of 63) obsolete
classes.

In my current Squeak image, there are 11 obsolete classes after cleanup.
This means that there are 11 classes that are not registered in the
namespace, but can not be garbage collected. Chasing pointers shows that
most (all?) of these classes are actually referenced by some methods, which
can themselves not be garbage collected because they are still referenced in
a ChangeRecord. So, if I get rid of these ChangeSets, I also get rid of the
methods and the obsolete classes.

So, in my opinion, it makes perfect sense to have obsolete classes in the
image even after cleaning up. In fact, it would even be a little bit
suspicious if there weren't any.

Cheers,
Nathanael


> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org
> [mailto:squeak-dev-admin at lists.squeakfoundation.org]On Behalf Of Tim
> Rowledge
> Sent: Dienstag, 23. April 2002 22:08
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: [Fix] ClassBuilder (Obsolete Classes)
>
>
> Ned Konz <ned at bike-nomad.com> is claimed by the authorities to
> have written:
>
>
> > Running it on my recent image gives:
> >
> > *** Before cleaning up ***
> > Really obsolete metaclasses: 165
> > Really obsolete classes: 165
> >
> > Start fixing the class hierarchy and cleaning up...DONE
> > Start checking the class hierarchy...OK
> >
> > *** After cleaning up ***
> > Really obsolete metaclasses: 63
> > Really obsolete classes: 63
> It's hard to imagine that there should be any obsolete classes left,
> wonder what is still keeping them around? Definitely some cleanup
> needed.
>
> Nathaniel, I see that this is almost (but not quite) the same as a fix
> Andreas recently passed around; which is more recent, more 'fixed'?
>
> tim
> --
> Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
> Useful random insult:- Stumped by anything child-proof.
>
>




More information about the Squeak-dev mailing list