[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft]Some problem about FTC_Cache_RemoveFaceID
From: |
于晨 |
Subject: |
[ft]Some problem about FTC_Cache_RemoveFaceID |
Date: |
Mon, 17 Jan 2011 20:16:21 +0800 (CST) |
Hello everyone,
I found some strange thing when I used FTC_Cache_RemoveFaceID() to clear
the cmap cache nodes, it seemed that there was a node can't be freed, as the
code is:
count = cache->p + cache->mask;
for ( i = 0; i < count; i++ )
{
FTC_Node* bucket = cache->buckets + i;
FTC_Node* pnode = bucket;
......
}
so I can only free the nodes linked from cache->buckets to
cache->buckets+count-1, but maybe there is a node recorded in
cache->buckets+count, as the code in ftc_cache_resize():
cache->buckets[p + mask + 1] = new_list; //<---here: it may become the
//
cache->buckets+count
cache->slack += FTC_HASH_MAX_LOAD;
if ( p >= mask )
{
cache->mask = 2 * mask + 1;
cache->p = 0;
}
else
cache->p = p + 1;
I noticed that in ftc_cache_resize() and FTC_Cache_Clear(), the "count" is
calculated as " cache->p + cache->mask + 1", which can cover the range to the
"cache->buckets+count".
Does anyone know why FTC_Cache_RemoveFaceID uses cache->p + cache->mask to
calculate the "count"?
thanks.
thealice
- [ft]Some problem about FTC_Cache_RemoveFaceID,
于晨 <=