--------------------- PatchSet 3667 Date: 2006/09/03 03:27:24 Author: hno Branch: valgrind Tag: (none) Log: Minor mempools cleanup Members: include/MemPool.h:1.7->1.7.4.1 lib/MemPool.cc:1.3.4.3->1.3.4.4 src/main.cc:1.71.4.2->1.71.4.3 Index: squid3/include/MemPool.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/include/MemPool.h,v retrieving revision 1.7 retrieving revision 1.7.4.1 diff -u -r1.7 -r1.7.4.1 --- squid3/include/MemPool.h 12 May 2006 13:49:56 -0000 1.7 +++ squid3/include/MemPool.h 3 Sep 2006 03:27:24 -0000 1.7.4.1 @@ -109,6 +109,7 @@ virtual void free(void *) = 0; virtual char const *objectType() const; virtual size_t objectSize() const = 0; + int inUseCount(); private: const char *label; }; Index: squid3/lib/MemPool.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/lib/MemPool.cc,v retrieving revision 1.3.4.3 retrieving revision 1.3.4.4 diff -u -r1.3.4.3 -r1.3.4.4 --- squid3/lib/MemPool.cc 3 Sep 2006 02:40:08 -0000 1.3.4.3 +++ squid3/lib/MemPool.cc 3 Sep 2006 03:27:24 -0000 1.3.4.4 @@ -1,6 +1,6 @@ /* - * $Id: MemPool.cc,v 1.3.4.3 2006/09/03 02:40:08 hno Exp $ + * $Id: MemPool.cc,v 1.3.4.4 2006/09/03 03:27:24 hno Exp $ * * DEBUG: section 63 Low Level Memory Pool Management * AUTHOR: Alex Rousskov, Andres Kroonmaa, Robert Collins @@ -453,6 +453,14 @@ return label; } +int +MemAllocator::inUseCount() +{ + MemPoolStats stats; + getStats(&stats); + return stats.items_inuse; +} + void MemImplementingAllocator::flushMeters() { @@ -832,10 +840,7 @@ int memPoolInUseCount(MemAllocator * pool) { - MemPoolStats stats; - assert(pool != NULL); - pool->getStats(&stats); - return stats.items_inuse; + return pool->inUseCount(); } int Index: squid3/src/main.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/main.cc,v retrieving revision 1.71.4.2 retrieving revision 1.71.4.3 diff -u -r1.71.4.2 -r1.71.4.3 --- squid3/src/main.cc 3 Sep 2006 03:10:10 -0000 1.71.4.2 +++ squid3/src/main.cc 3 Sep 2006 03:27:24 -0000 1.71.4.3 @@ -1,6 +1,6 @@ /* - * $Id: main.cc,v 1.71.4.2 2006/09/03 03:10:10 hno Exp $ + * $Id: main.cc,v 1.71.4.3 2006/09/03 03:27:24 hno Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -415,8 +415,6 @@ fatal("Need to add -DMALLOC_DBG when compiling to use -mX option"); #endif - } - } else { #if XMALLOC_TRACE xmalloc_trace = !xmalloc_trace;