In Spoofax 0.4.7.1, services are cached using weak references. These are basically freed on each garbage collect, which should not happen if the service belongs to the active editor.

Submitted by Nathan Bruning on 25 May 2010 at 17:46

On 26 May 2010 at 19:11 Lennart Kats closed this issue.

On 26 May 2010 at 19:11 Lennart Kats commented:

Actually 0.4.7.1 should already include the WeakSoftMap. 0.4.7 still had a WeakWeakMap.

It turns out the problem with the WeakWeakMap is that I didn’t use it right: I had a Map<...,WeakReference<Map<Class,ILanguageService>>> and I needed a Map<...,Map<Class,WeakReference<ILanguageService>>>. No strong reference existed to the inner map, so it was garbage collected. Doh. I fixed this in r20873: services are now cached as long as their editor is open. A further improvement may be to use a SoftReference<HybridInterpreter> in StrategoObserver, to make sure it can even be collected before the editor is closed (Spoofax/138).

Log in to post comments