Memory Management (Memory Pool Allocator)
Collaboration diagram for Memory Management (Memory Pool Allocator):
Classes | |
class | MemPools |
class | MemPoolChunked |
class | MemChunk |
class | MemPoolMalloc |
Macros | |
#define | toMB(size) ( ((double) size) / ((double)(1024*1024)) ) |
#define | toKB(size) ( (size + 1024 - 1) / 1024 ) |
Detailed Description
- MemPools are a pooled memory allocator running on top of malloc(). It's purpose is to reduce memory fragmentation and provide detailed statistics on memory consumption.
- Preferably all memory allocations in Squid should be done using MemPools or one of the types built on top of it (i.e. cbdata).
- Note
- Usually it is better to use cbdata types as these gives you additional safeguards in references and typechecking. However, for high usage pools where the cbdata functionality of cbdata is not required directly using a MemPool might be the way to go.