=== modified file 'src/Mem.h'
--- src/Mem.h	2010-11-21 04:40:05 +0000
+++ src/Mem.h	2011-03-30 06:51:13 +0000
@@ -34,8 +34,8 @@
 #ifndef SQUID_MEM
 #define SQUID_MEM
 
-#if HAVE_OSTREAM
-#include <ostream>
+#if HAVE_IOSFWD
+#include <iosfwd>
 #endif
 
 class StoreEntry;

=== modified file 'src/MemBlob.cc'
--- src/MemBlob.cc	2010-12-03 01:56:04 +0000
+++ src/MemBlob.cc	2011-03-30 06:51:13 +0000
@@ -32,16 +32,14 @@
 #include "config.h"
 #include "base/TextException.h"
 #include "Debug.h"
+#include "Mem.h"
 #include "MemBlob.h"
+#include "protos.h"
+
 #if HAVE_IOSTREAM
 #include <iostream>
 #endif
 
-#define MEMBLOB_USES_MEM_POOLS 0
-
-#if MEMBLOB_USES_MEM_POOLS
-#include "protos.h"
-#endif
 
 MemBlobStats MemBlob::Stats;
 InstanceIdDefinitions(MemBlob, "blob");
@@ -90,13 +88,7 @@
 
 MemBlob::~MemBlob()
 {
-#if MEMBLOB_USES_MEM_POOLS
-    //no mempools for now
-    // \todo reinstate mempools use
     memFreeString(capacity,mem);
-#else
-    xfree(mem);
-#endif
     Stats.liveBytes -= capacity;
     --Stats.live;
 
@@ -106,26 +98,19 @@
            << " size=" << size);
 }
 
-/**
- * Given the requested minimum size, return a rounded allocation size
+/** Given the requested minimum size, return a rounded allocation size
  * for the backing store.
- * This is a stopgap call, this job is eventually expected to be handled
- * by MemPools via memAllocString.
  */
-MemBlob::size_type
+// TODO: exploit better integration with MemPools, moving much of this there.
+// TODO: have MemPools do system page size magic. They don't really belong here
+inline MemBlob::size_type
 MemBlob::calcAllocSize(const size_type sz) const
 {
     if (sz <= 36) return 36;
     if (sz <= 128) return 128;
     if (sz <= 512) return 512;
     if (sz <= 4096) return RoundTo(sz, 512);
-    // XXX: recover squidSystemPageSize functionality. It's easy for
-    //      the main squid, harder for tests
-#if 0
-    return RoundTo(sz, squidSystemPageSize);
-#else
     return RoundTo(sz, 4096);
-#endif
 }
 
 /** Allocate an available space area of at least minSize bytes in size.
@@ -137,14 +122,7 @@
     size_t actualAlloc = calcAllocSize(minSize);
 
     Must(!mem);
-#if MEMBLOB_USES_MEM_POOLS
-    // XXX: for now, do without mempools. In order to do it, MemPools
-    //  need to be singletons so that initialization order can be enforced
-    mem = static_cast<char*>(memAllocString(minSize, &actualAlloc));
-#else
-    // \todo reinstate mempools use
-    mem = static_cast<char*>(xmalloc(actualAlloc));
-#endif
+    mem = static_cast<char*>(memAllocString(actualAlloc, &actualAlloc));
     Must(mem);
 
     capacity = actualAlloc;

=== modified file 'src/mem.cc'
--- src/mem.cc	2010-10-28 18:52:59 +0000
+++ src/mem.cc	2011-03-30 06:51:14 +0000
@@ -70,7 +70,6 @@
 }
 
 StrPoolsAttrs[mem_str_pool_count] = {
-
     {
         "Short Strings", MemAllocator::RoundedSize(36),
     },				/* to fit rfc1123 and similar */
@@ -230,12 +229,13 @@
 {
     int i;
     MemAllocator *pool = NULL;
-    assert(size && buf);
+    assert(buf);
 
     for (i = 0; i < mem_str_pool_count; i++) {
-        if (size <= StrPoolsAttrs[i].obj_size) {
-            assert(size == StrPoolsAttrs[i].obj_size);
-            pool = StrPools[i].pool;
+        if (size > StrPoolsAttrs[i].obj_size)
+        	break;
+        if (size == StrPoolsAttrs[i].obj_size) {
+			pool = StrPools[i].pool;
             break;
         }
     }
@@ -380,7 +380,7 @@
 void
 Mem::Init(void)
 {
-    int i;
+	int i;
 
     /** \par
      * NOTE: Mem::Init() is called before the config file is parsed

