virtual char const *objectType() const;
virtual size_t objectSize() const = 0;
int inUseCount();
+ virtual void setChunkSize(size_t chunksize) {}
private:
const char *label;
};
#define SIZEOF_CHUNK ( ( sizeof(MemChunk) + sizeof(double) -1) / sizeof(double) ) * sizeof(double);
+#define memPoolCreate MemPools::GetInstance().create
+
/* Allocator API */
extern MemPoolIterator * memPoolIterate(void);
extern MemImplementingAllocator * memPoolIterateNext(MemPoolIterator * iter);
/*
- * $Id: ACLStrategised.h,v 1.10 2005/05/08 06:36:45 hno Exp $
+ * $Id: ACLStrategised.h,v 1.11 2006/09/03 21:05:20 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
assert (byteCount == sizeof (ACLStrategised<MatchType>));
if (!Pool)
- Pool = MemPools::GetInstance().create("ACLStrategised", sizeof (ACLStrategised<MatchType>));
+ Pool = memPoolCreate("ACLStrategised", sizeof (ACLStrategised<MatchType>));
return Pool->alloc();
}
/*
- * $Id: DiskThreadsIOStrategy.cc,v 1.8 2006/09/03 04:12:00 hno Exp $
+ * $Id: DiskThreadsIOStrategy.cc,v 1.9 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 79 Squid-side Disk I/O functions.
* AUTHOR: Robert Collins
if (initialised)
return;
- squidaio_ctrl_pool = MemPools::GetInstance().create("aio_ctrl", sizeof(squidaio_ctrl_t));
+ squidaio_ctrl_pool = memPoolCreate("aio_ctrl", sizeof(squidaio_ctrl_t));
initialised = true;
/*
- * $Id: aiops.cc,v 1.11 2006/09/03 04:12:01 hno Exp $
+ * $Id: aiops.cc,v 1.12 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 43 AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
done_queue.blocked = 0;
/* Create threads and get them to sit in their wait loop */
- squidaio_thread_pool = MemPools::GetInstance().create("aio_thread", sizeof(squidaio_thread_t));
+ squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t));
assert(NUMTHREADS);
}
/* Create request pool */
- squidaio_request_pool = MemPools::GetInstance().create("aio_request", sizeof(squidaio_request_t));
+ squidaio_request_pool = memPoolCreate("aio_request", sizeof(squidaio_request_t));
- squidaio_large_bufs = MemPools::GetInstance().create("squidaio_large_bufs", AIO_LARGE_BUFS);
+ squidaio_large_bufs = memPoolCreate("squidaio_large_bufs", AIO_LARGE_BUFS);
- squidaio_medium_bufs = MemPools::GetInstance().create("squidaio_medium_bufs", AIO_MEDIUM_BUFS);
+ squidaio_medium_bufs = memPoolCreate("squidaio_medium_bufs", AIO_MEDIUM_BUFS);
- squidaio_small_bufs = MemPools::GetInstance().create("squidaio_small_bufs", AIO_SMALL_BUFS);
+ squidaio_small_bufs = memPoolCreate("squidaio_small_bufs", AIO_SMALL_BUFS);
- squidaio_tiny_bufs = MemPools::GetInstance().create("squidaio_tiny_bufs", AIO_TINY_BUFS);
+ squidaio_tiny_bufs = memPoolCreate("squidaio_tiny_bufs", AIO_TINY_BUFS);
- squidaio_micro_bufs = MemPools::GetInstance().create("squidaio_micro_bufs", AIO_MICRO_BUFS);
+ squidaio_micro_bufs = memPoolCreate("squidaio_micro_bufs", AIO_MICRO_BUFS);
squidaio_initialised = 1;
}
/*
- * $Id: Store.h,v 1.25 2006/08/21 00:50:41 robertc Exp $
+ * $Id: Store.h,v 1.26 2006/09/03 21:05:20 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
virtual void release();
private:
- static MemImplementingAllocator *pool;
+ static MemAllocator *pool;
bool validLength() const;
};
/*
- * $Id: auth_digest.cc,v 1.49 2006/09/03 04:12:01 hno Exp $
+ * $Id: auth_digest.cc,v 1.50 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
authenticateDigestNonceSetup(void)
{
if (!digest_nonce_pool)
- digest_nonce_pool = MemPools::GetInstance().create("Digest Scheme nonce's", sizeof(digest_nonce_h));
+ digest_nonce_pool = memPoolCreate("Digest Scheme nonce's", sizeof(digest_nonce_h));
if (!digest_nonce_cache) {
digest_nonce_cache = hash_create((HASHCMP *) strcmp, 7921, hash_string);
/*
- * $Id: cbdata.cc,v 1.74 2006/09/03 05:29:44 hno Exp $
+ * $Id: cbdata.cc,v 1.75 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 45 Callback Data Registry
* ORIGINAL AUTHOR: Duane Wessels
size += cbdata::Offset;
#endif
- cbdata_index[type].pool = MemPools::GetInstance().create(label, size);
+ cbdata_index[type].pool = memPoolCreate(label, size);
cbdata_index[type].free_func = free_func;
/*
- * $Id: comm.cc,v 1.422 2006/09/02 10:39:53 adrian Exp $
+ * $Id: comm.cc,v 1.423 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
* Since Squid_MaxFD can be as high as several thousand, don't waste them */
RESERVED_FD = XMIN(100, Squid_MaxFD / 4);
- comm_write_pool = MemPools::GetInstance().create("CommWriteStateData", sizeof(CommWriteStateData));
+ comm_write_pool = memPoolCreate("CommWriteStateData", sizeof(CommWriteStateData));
- conn_close_pool = MemPools::GetInstance().create("close_handler", sizeof(close_handler));
+ conn_close_pool = memPoolCreate("close_handler", sizeof(close_handler));
}
/* Write to FD. */
/*
- * $Id: StoreFScoss.cc,v 1.6 2006/09/03 04:12:02 hno Exp $
+ * $Id: StoreFScoss.cc,v 1.7 2006/09/03 21:05:21 hno Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Robert Collins
{
assert(!initialised);
- coss_index_pool = MemPools::GetInstance().create("COSS index data", sizeof(CossIndexNode));
+ coss_index_pool = memPoolCreate("COSS index data", sizeof(CossIndexNode));
initialised = true;
}
/*
- * $Id: htcp.cc,v 1.69 2006/08/25 18:53:35 serassio Exp $
+ * $Id: htcp.cc,v 1.70 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 31 Hypertext Caching Protocol
* AUTHOR: Duane Wesssels
}
if (!htcpDetailPool) {
- htcpDetailPool = MemPools::GetInstance().create("htcpDetail", sizeof(htcpDetail));
+ htcpDetailPool = memPoolCreate("htcpDetail", sizeof(htcpDetail));
}
}
/*
- * $Id: mem.cc,v 1.100 2006/09/03 04:09:36 hno Exp $
+ * $Id: mem.cc,v 1.101 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 13 High Level Memory Pool Management
* AUTHOR: Harvest Derived
static void memStringStats(std::ostream &);
/* module locals */
-static MemImplementingAllocator *MemPools[MEM_MAX];
+static MemAllocator *MemPools[MEM_MAX];
static double xm_time = 0;
static double xm_deltat = 0;
{
assert(name && size);
assert(MemPools[type] == NULL);
- MemPools[type] = MemPools::GetInstance().create(name, size);
+ MemPools[type] = memPoolCreate(name, size);
}
/* init string pools */
for (i = 0; i < mem_str_pool_count; i++) {
- StrPools[i].pool = MemPools::GetInstance().create(StrPoolsAttrs[i].name, StrPoolsAttrs[i].obj_size);
+ StrPools[i].pool = memPoolCreate(StrPoolsAttrs[i].name, StrPoolsAttrs[i].obj_size);
if (StrPools[i].pool->objectSize() != StrPoolsAttrs[i].obj_size)
debugs(13, 1, "Notice: " << StrPoolsAttrs[i].name << " is " << StrPools[i].pool->objectSize() << " bytes instead of requested " << StrPoolsAttrs[i].obj_size << " bytes");
/*
- * $Id: pconn.cc,v 1.46 2006/05/29 00:15:02 robertc Exp $
+ * $Id: pconn.cc,v 1.47 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 48 Persistent Connections
* AUTHOR: Duane Wessels
PconnModule::PconnModule() : pools(NULL), poolCount(0)
{
pools = (PconnPool **) xcalloc(MAX_NUM_PCONN_POOLS, sizeof(*pools));
- pconn_fds_pool = MemPools::GetInstance().create("pconn_fds", PCONN_FDS_SZ * sizeof(int));
+ pconn_fds_pool = memPoolCreate("pconn_fds", PCONN_FDS_SZ * sizeof(int));
debug(48, 0) ("persistent connection module initialized\n");
}
/*
- * $Id: store_repl_lru.cc,v 1.19 2006/09/03 04:12:04 hno Exp $
+ * $Id: store_repl_lru.cc,v 1.20 2006/09/03 21:05:21 hno Exp $
*
* DEBUG: section ? LRU Removal policy
* AUTHOR: Henrik Nordstrom
dlink_node node;
};
-static MemImplementingAllocator *lru_node_pool = NULL;
+static MemAllocator *lru_node_pool = NULL;
static int nr_lru_policies = 0;
static void
if (!lru_node_pool) {
/* Must be chunked */
- lru_node_pool = MemPools::GetInstance().create("LRU policy node", sizeof(LruNode));
+ lru_node_pool = memPoolCreate("LRU policy node", sizeof(LruNode));
lru_node_pool->setChunkSize(512 * 1024);
}
/*
- * $Id: store.cc,v 1.599 2006/09/03 04:09:48 robertc Exp $
+ * $Id: store.cc,v 1.600 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
* local variables
*/
static Stack<StoreEntry*> LateReleaseStack;
-MemImplementingAllocator *StoreEntry::pool = NULL;
+MemAllocator *StoreEntry::pool = NULL;
StorePointer Store::CurrentRoot = NULL;
assert (bytecount == sizeof (StoreEntry));
if (!pool) {
- pool = MemPools::GetInstance().create ("StoreEntry", bytecount);
+ pool = memPoolCreate ("StoreEntry", bytecount);
pool->setChunkSize(2048 * 1024);
}
/*
- * $Id: tools.cc,v 1.269 2006/08/19 12:31:21 robertc Exp $
+ * $Id: tools.cc,v 1.270 2006/09/03 21:05:20 hno Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
dlinkNodeNew()
{
if (dlink_node_pool == NULL)
- dlink_node_pool = MemPools::GetInstance().create("Dlink list nodes", sizeof(dlink_node));
+ dlink_node_pool = memPoolCreate("Dlink list nodes", sizeof(dlink_node));
/* where should we call delete dlink_node_pool;dlink_node_pool = NULL; */
return (dlink_node *)dlink_node_pool->alloc();
/*
- * $Id: MemPoolTest.cc,v 1.5 2006/09/03 07:25:13 robertc Exp $
+ * $Id: MemPoolTest.cc,v 1.6 2006/09/03 21:05:22 hno Exp $
*
* AUTHOR: Robert Collins
*
public:
int aValue;
};
- static MemImplementingAllocator *Pool;
+ static MemAllocator *Pool;
};
-MemImplementingAllocator *MemPoolTest::Pool = NULL;
+MemAllocator *MemPoolTest::Pool = NULL;
void
MemPoolTest::run()
{
assert (Pool == NULL);
- Pool = MemPools::GetInstance().create("Test Pool", sizeof(SomethingToAlloc));
+ Pool = memPoolCreate("Test Pool", sizeof(SomethingToAlloc));
assert (Pool);
SomethingToAlloc *something = static_cast<SomethingToAlloc *>(Pool->alloc());
assert (something);
/*
- * $Id: test_tools.cc,v 1.8 2006/08/12 01:43:12 robertc Exp $
+ * $Id: test_tools.cc,v 1.9 2006/09/03 21:05:22 hno Exp $
*
* AUTHOR: Robert Collins
*
std::ostringstream *Debug::CurrentDebug (NULL);
-MemImplementingAllocator *dlink_node_pool = NULL;
+MemAllocator *dlink_node_pool = NULL;
dlink_node *
dlinkNodeNew() {
if (dlink_node_pool == NULL)
- dlink_node_pool = MemPools::GetInstance().create("Dlink list nodes", sizeof(dlink_node));
+ dlink_node_pool = memPoolCreate("Dlink list nodes", sizeof(dlink_node));
/* where should we call memPoolDestroy(dlink_node_pool); */
return static_cast<dlink_node *>(dlink_node_pool->alloc());