[Glass] orphaned classes do not disappear

Johan Brichau via Glass glass at lists.gemtalksystems.com
Wed Mar 8 04:05:58 PST 2017


I already executed the following expressions I picked up from earlier discussions and that fix some memory leaks:

GsDeployer cleanClassHistory.
  MCDefinition clearInstances.
  MCMethodDefinition resetCachedDefinitions.
	UndefinedSymbols removeAll.
  MethodVersionHistory reset.
  "MetacelloConfigurationResource reset."
  UserGlobals removeKey: #GsDeployerBar_Instances ifAbsent: [].
  SystemOrganizer resetSystemOrganization.
  UndefinedSymbolsTest new cleanUndefinedSymbols.

  System myUserProfile symbolList do: [:symbolDictionary |
        symbolDictionary valuesDo: [:global |
          global isBehavior ifTrue: [ | desc |
            (desc := global instVarNamed: 'description' ) notNil
              ifTrue: [
                desc itsClass ~~ global
                  ifTrue: [ global description itsClass: global ]]]]].

> On 8 Mar 2017, at 13:01, Johan Brichau <johan at yesplan.be> wrote:
> Hi there,
> I am working on preparing a GS extent for upgrade to GS 3.2
> For that, I am cleaning the repo such that no orphaned class instances still exist.
> I hit an issue because I find orphaned classes that are not GC’ed for which no instances still exist.
> When I ask the reference path to the class object, it tells me it is being referenced by its metaclass.
> However, when I ask for the reference path to the metaclass object, I get a ‘false’ response.
> Is there anything I can do to make sure these instances (of MetaClass) are removed (or otherwise find out why they are not GC’ed) ?
> thanks
> Johan
> For reference, this is the script to find orphaned classes:
> | classes orphans |
>    classes := IdentitySet new.
>    System myUserProfile symbolList do: [:symbolDictionary |
>      symbolDictionary valuesDo: [:global |
>              global isBehavior ifTrue: [ classes add: global ]]].
>    System commitTransaction.
>    orphans :=  (Metaclass allInstances collect: [:mClass | mClass theNonMetaClass ])
>                              select: [:class | (classes includes: class) not ].

More information about the Glass mailing list