Branch: Tag:

2010-09-23

2010-09-23 20:02:41 by Martin Stjernholm <mast@lysator.liu.se>

Fixed size calculation bug in manager_size_overhead.

If there were extra refs to some cache mapping on the stack (e.g. when
called via low_add_entry), it didn't include that mapping in the size.

Also, together with an as yet future optimization in
Pike.count_memory, this avoids a running time in manager_size_overhead
(and hence update_size_limit) that is linear wrt the cache size.

Rev: server/base_server/cache.pike:1.134

1:   // This file is part of Roxen WebServer.   // Copyright © 1996 - 2009, Roxen IS. - // $Id: cache.pike,v 1.133 2010/09/23 19:07:57 mast Exp $ + // $Id: cache.pike,v 1.134 2010/09/23 20:02:41 mast Exp $      // FIXME: Add argcache, imagecache & protcache   
324: Inside #if defined(NEW_RAM_CACHE)
   //! Returns the size consumed by the manager itself, excluding the    //! cache entries.    { -  return (Pike.count_memory (-1, this) + -  Pike.count_memory (0, stats) + -  Pike.count_memory ((["block_objects": 1]), lookup)); +  int res = (Pike.count_memory (-1, this, lookup) + +  Pike.count_memory (0, stats)); +  foreach (lookup;; mapping(mixed:CacheEntry) lm) +  res += Pike.count_memory (-1, lm); +  return res;    }       float add_rate = 0.0;