[cairo] glyph caching bug

Keith Packard keithp at keithp.com
Wed Dec 29 15:05:24 PST 2004


Around 7 o'clock on Dec 30, TOKUNAGA Hiroyuki wrote:

> _random_live_entry is called when we want to destroy an cache entry to
> keep cache size. So if this function is failed, we wouldn't able to keep
> cache size.

Right, it will only fail when all of the cache entries are locked, in 
which case the cache will (temporarily) need to grow larger than the 
limit.  There's not much we can do about that at the cache level, the 
correct fix would be to change the upper levels to not lock down so many 
cache entries.

> A little while ago I conceived, what happen if we use many glyphs which
> over maximum cache size? 

Then we temporarily expand the cache to cover the demand.  We might 
consider doing some working set analysis to find an optimum cache size at 
run time, but I suggest we wait on that and just get the simple code 
working first.

> > This doesn't appear to handle the case of multiple threads looking up
> > the  same element in the cache simultaneously -- they'll both miss,
> > and then  they'll both create the element and register it.
>
> Yes, such a thing will happen. One will be registered, another will not
> be registered.

Oh, that would work, and would let us leave the cache unlocked for more of
the time.  We could also do this entirely within the nominally 'atomic'
cache architecture we have now.  I suggest we leave those details hidden 
behind the existing API and see how things look when it is working.

-keith


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20041229/6403a6e2/attachment.pgp


More information about the cairo mailing list