[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] LRU Cache doesn't appear to be entirely LRU ?!
From: |
Richard Barber |
Subject: |
[Devel] LRU Cache doesn't appear to be entirely LRU ?! |
Date: |
Fri, 21 Sep 2001 14:47:00 +0100 (BST) |
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?
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
------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Devel] LRU Cache doesn't appear to be entirely LRU ?!,
Richard Barber <=