xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter B. West" <...@pbw.id.au>
Subject Re: Memory Leak in PropertyCache: need ideas
Date Fri, 22 Aug 2008 22:59:59 GMT
Jeremias Maerki wrote:
> There's a lot of AND-ing of hash codes to determine the segments and
> buckets and that's much easier to handle if you have a power of 2 and
> can shift bits around.
> 
> On 22.08.2008 16:22:05 Peter B. West wrote:
>> Jeremias Maerki wrote:
>>> Ok, here's the final patch I'd propose to fix the memory leak. I've seen
>>> no measurable performance degradation compared to the base revision and
>>> no multi-threading problems. The memory leak is fixed and the number of
>>> stale references remains low.
>>>
>>> Feedback welcome.
>>>
>> What happens is SEGMENT_COUNT is not a power of 2? Or, what obliges 
>> SEGMENT_COUNT to be a power of 2?
>>
>> Peter

That was my assumption when I saw 'MASK', in which case is it not safer 
to ensure that your value is in fact all ones?

MASK_BIT_COUNT = 5
SEGMENT_COUNT = 1<<MASK_BIT_COUNT

or some such.

Mime
View raw message