On 25 February 2013 11:52, Peter Lieven <p...@dlhnet.de> wrote: > The page cache frees all data on finish, on resize and > if there is collision on insert. So it should be the caches > responsibility to dup the data that is stored in the cache.
> diff --git a/page_cache.c b/page_cache.c > index a6c3a15..e670d91 100644 > --- a/page_cache.c > +++ b/page_cache.c > @@ -158,7 +158,7 @@ void cache_insert(PageCache *cache, uint64_t addr, > uint8_t *pdata) > g_free(it->it_data); > } > > - it->it_data = pdata; > + it->it_data = g_memdup(pdata, cache->page_size); > it->it_age = ++cache->max_item_age; > it->it_addr = addr; > } Doesn't this introduce a leak on cache resize in the case where the element being moved from the old cache to the new does not collide with any element we've already moved? [ie the code path where we just cache_insert() the old item's data]. -- PMM