Service caching
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
Issue Log
Actually 0.4.7.1 should already include the
WeakSoftMap
. 0.4.7 still had aWeakWeakMap
.It turns out the problem with the
WeakWeakMap
is that I didn’t use it right: I had aMap<...,WeakReference<Map<Class,ILanguageService>>>
and I needed aMap<...,Map<Class,WeakReference<ILanguageService>>>
. No strong reference existed to the inner map, so it was garbage collected. Doh. I fixed this inr20873
: services are now cached as long as their editor is open. A further improvement may be to use aSoftReference<HybridInterpreter>
inStrategoObserver
, to make sure it can even be collected before the editor is closed (Spoofax/138).
Log in to post comments