The software I am working on generates classes on the fly, and discards
those classes when they are no longer needed. The class library is
cross-platform, i.e. it exists for Dolphin and VisualWorks, and I am
currently porting it to Pharo.
In Dolphin, it is necessary to flush the VM's method cache after discarding
all the dynamically generated classes, because the method cache holds
references to the classes which prevent them from being garbage collected.
For VisualWorks, I have adopted this, although I am not quite sure if it's
actually needed there.
In the Pharo 1.0 image, I haven't found a method for flushing the VM's
method cache in one go, there only seems to be Behavior>>flushCache.
What I would like to know is:
- Does the VM method cache of the Squeak VM hold references to classes which
prevent an obsolete class from being garbage collected? If this is not the
case, I don't need to flush anything.
- If flushing the cache is advisable, is Behavior>>flushCache the only way
to do this? I would have to pick up all the obsolete classes and iterate
over them in that case.