|
Boost : |
From: Wei FENG (fw37fw37_at_[hidden])
Date: 2007-07-08 23:34:03
When using the "singleton_pool" to allocate the new space, I found there is
a limitation in this pool. If I want to allocate 16KB memory space,I can do
it by call 65503 times( about 1GB space has been used ). Then, I established
another singleton_pool object to allocate 1KB space ,this time I succeed
524255 times( about 500MB memory space). I want to know whether there is a
limitation in that?
thx.
ps : the sample codes:
typedef boost::singleton_pool<PieceMemoryPoolTag, UDP_BIG_BUFFER_SIZE+1>
BigPool;
void* BigMemPool::malloc(void)
{
void *pbuf = BigPool::malloc();
assert(pbuf);
if (pbuf != NULL)
{
memset(pbuf, 0, UDP_BIG_BUFFER_SIZE+1);
bigmalloctimes++;
char str[128];
sprintf_s(str, "BigMemPool::malloc %lu", bigmalloctimes);
}
return pbuf;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk