freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] LRU Cache doesn't appear to be entirely LRU ?!


From: David Turner
Subject: Re: [Devel] LRU Cache doesn't appear to be entirely LRU ?!
Date: Sun, 07 Oct 2001 13:07:46 +0200

Hello Richard,

Richard Barber a écrit :
> 
> Hi,
> 
> We've been making use of the FreeType cache for caching Faces,
> Sizes and glyphs for a while but noticed that if executing
> the following (+ all the usual error checking)
> 
> FTC_Lookup_Size( ....., &phFaceA );
> FTC_Lookup_Size( ....., &phFaceB );
> 
> With a default cache setup (4 Faces, 8 Sizes), it was possible
> for phFaceA to be ejected from the cache by the lookup of phFaceB.
> 
> Now, with an LRU cache setup as above, this shouldn't really happen
> (as the LRU item should be ejected first). However what appears to
> currently happen (in FT_Lru_Lookup_Node) is that once a node is found,
> it is left in it's existing position, rather than being promoted to
> the start of the LRU list.
> 
> The end result is that you seem to only ever replace the same (last) item
> in the LRU list (unless some other function that DOES actually move the
> node is called in the meantime).
> 
> We've made a change to move a node to the start of the LRU list if
> FT_Lru_Lookup_Node succeeds, but is that the right thing to do in
> this situation?
>

Yes, it is. Actually this was a _rather_ stupid bug. Thanks a lot
for spotting this, the fix has been commited to the CVS..

Cheers,

- David

 
> regards,
> Richard
> 
> ---------------------------------------------------
> $ cvs diff -n src/cache/ftlru.c
> d180 1
> a180 6
>     if ( found )
>     {
>       /* move element to top of list */
>       FT_List_Up( &lru->elements, node );
>     }
>     else
> ------------------------------------------------
> 
> _______________________________________________
> Devel mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]