[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [mylyn-vex-dev] Why is StyleSheet using WeakReference for cached styles?
- From: Florian Thienel <florian@xxxxxxxxxxx>
- Date: Sun, 14 Jul 2013 19:36:44 +0200
- Delivered-to: email@example.com
- User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7
I don't know the rational behind the weak references, but I think memory
is not an issue for the stylesheets, and normally a stylesheet will not
change at runtime (although we handle changes of the stylesheet files in
Vex plug-ins at runtime, but a little extra work in this less common use
case should be ok). So using hard references will make the style
handling a lot easier and less error prone.
+1 for my side to replace the weak references with hard references.
Am 14.07.2013 12:37, schrieb Carsten Hiesserich:
i'm playing with CSS properties and realized that the styles are
recalculated every time the layout is refreshed. There is a caching
mechanism for calculated styles, but this is using a WeakReference.
Since the styles are apparently not referenced elsewhere, the cached
styles are GC'ed every few seconds and have to be recalculated.
As long a i don't misunderstand the function of the cache (which is very
well possible) i think strong references should be used here, and the
styles should stay in the cache until StyleSheet#flushStyles is called.
mylyn-vex-dev mailing list