Evaluate Weak References for the TextGridObject registry [was #7498]
{color:red}
reported by [~vitt] at 2008-09-18
previously known as [trac#83|http://www.textgrid.de/trac/ticket/83] {color}
Currently, every TGO ever seen during the current Lab run is kept in memory - it is added to the registry and will never be removed from there, causing its reference count to be >= 1.
[Weak_references|http://en.wikipedia.org/wiki/Weak_reference] are a Java language feature that allows to refer to an object without increasing its reference counter, and thus allowing the objects referred to to be garbage collected.. It is possible to build Collections on top of this (this is done in Vex' layout engine). AFAICS, weak references would be fine for our registry since the registry's purpose is to avoid that more than one TGO exists for an URI. However, a TGO can only be gc'ed if there is no more regular link for it, only weak references, so that would be fine (as long as nobody else uses weak references on our TGO, but we can simply forbid this).