httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Jacques Clar" <>
Subject bug between mem_cache and the max heap?
Date Wed, 19 Nov 2003 18:34:58 GMT
The heap in cache_pqueue is a max head, it always keep the object
with the highest priority in its root position. The object with the
priority is the one that is ejected when a new element has to be 
inserted when the cache is full (max nb of entities or size reached).
The return value of the set priority functions in mod_mem_cache.c: 
and the get_priority() function 
have to be consistent to make sure the heap is bubbling and percolating
Right now set_pri() return a negative value and get_pri() a positive
Because mem_cache increments the priority field based on the number of
and the relative time an entity is inserted in the cache, both should
return a negative value,
to use correctly the max heap.
The attached patch is a way to fix that problem, not sure if it is the
best. The max heap
could also be turned into a min heap, but it is probably easier to fix

View raw message