Memory Management (Memory Pool Allocator)
[Squid Components]
|
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.
Define Documentation
| #define MEM_CHUNK_MAX_SIZE 256 * 1024 |
Definition at line 11 of file MemPoolChunked.h.
| #define MEM_CHUNK_MAX_SIZE 256 * 1024 |
Definition at line 57 of file MemPool.h.
Referenced by MemPoolChunked::setChunkSize().
| #define MEM_CHUNK_SIZE 4096 * 4 |
Definition at line 9 of file MemPoolChunked.h.
| #define MEM_CHUNK_SIZE 4096 * 4 |
Definition at line 55 of file MemPool.h.
Referenced by MemPoolChunked::MemPoolChunked().
| #define MEM_MAX_FREE 65535 |
Definition at line 15 of file MemPoolChunked.h.
| #define MEM_MAX_FREE 65535 |
Definition at line 61 of file MemPool.h.
Referenced by MemPoolChunked::setChunkSize().
| #define MEM_MIN_FREE 32 |
Definition at line 13 of file MemPoolChunked.h.
| #define MEM_MIN_FREE 32 |
Definition at line 59 of file MemPool.h.
Referenced by MemPoolChunked::setChunkSize().
| #define MEM_PAGE_SIZE 4096 |
Definition at line 7 of file MemPoolChunked.h.
| #define MEM_PAGE_SIZE 4096 |
Definition at line 53 of file MemPool.h.
Referenced by MemPoolChunked::setChunkSize().
| #define memPoolCreate MemPools::GetInstance().create |
Definition at line 400 of file MemPool.h.
Referenced by authenticateDigestNonceSetup(), cbdataInternalInitType(), comm_init(), createRemovalPolicy_lru(), dlinkNodeNew(), htcpInit(), Mem::Init(), DiskThreadsIOStrategy::init(), memDataInit(), StoreEntry::operator new(), ACLStrategised< M >::operator new(), PconnModule::PconnModule(), StoreFScoss::setup(), and squidaio_init().
| #define MEMPROXY_CLASS | ( | CLASS | ) |
| #define MEMPROXY_CLASS_INLINE | ( | CLASS | ) |
Definition at line 50 of file MemPool.h.
Referenced by Mem::PoolReport().
Definition at line 48 of file MemPool.h.
Referenced by memConfigure(), and Mem::Report().
Typedef Documentation
| typedef struct _MemPoolGlobalStats MemPoolGlobalStats |
Function Documentation
| int memPoolGetGlobalStats | ( | MemPoolGlobalStats * | stats | ) |
- Todo:
- Stats API - not sured how to refactor yet
Fills MemPoolGlobalStats with statistical data about overall usage for all pools.
- Return values:
-
Number of pools that have at least one object in use. Ie. number of dirty pools.
Definition at line 290 of file MemPool.cc.
References MemPoolStats::chunks_alloc, MemPoolStats::chunks_free, MemPoolStats::chunks_inuse, MemPoolStats::chunks_partial, MemPools::flushMeters(), MemPools::GetInstance(), MemAllocator::getStats(), MemPoolStats::items_alloc, MemPoolStats::items_idle, MemPoolStats::items_inuse, MemPools::mem_idle_limit, _MemPoolGlobalStats::mem_idle_limit, memPoolIterate(), memPoolIterateDone(), memPoolIterateNext(), MemPoolStats::overhead, pool, Pool_id_counter, MemPools::poolCount, _MemPoolGlobalStats::TheMeter, _MemPoolGlobalStats::tot_chunks_alloc, _MemPoolGlobalStats::tot_chunks_free, _MemPoolGlobalStats::tot_chunks_inuse, _MemPoolGlobalStats::tot_chunks_partial, _MemPoolGlobalStats::tot_items_alloc, _MemPoolGlobalStats::tot_items_idle, _MemPoolGlobalStats::tot_items_inuse, _MemPoolGlobalStats::tot_overhead, _MemPoolGlobalStats::tot_pools_alloc, _MemPoolGlobalStats::tot_pools_inuse, and _MemPoolGlobalStats::tot_pools_mempid.
Referenced by info_get(), memClean(), memPoolsTotalAllocated(), and Mem::Report().
| int memPoolInUseCount | ( | MemAllocator * | ) |
Definition at line 339 of file MemPool.cc.
References MemAllocator::inUseCount().
Referenced by MemAllocatorProxy::inUseCount(), memInUse(), and memStringCount().
| MemPoolIterator* memPoolIterate | ( | void | ) |
Initialise iteration through all of the pools.
- Return values:
-
Iterator for use by memPoolIterateNext() and memPoolIterateDone()
Definition at line 77 of file MemPool.cc.
References MemPools::GetInstance(), MemPoolIterator::pool, and MemPools::pools.
Referenced by MemPools::clean(), MemPools::flushMeters(), memPoolGetGlobalStats(), and Mem::Report().
| void memPoolIterateDone | ( | MemPoolIterator ** | iter | ) |
Should be called after finished with iterating through all pools.
Definition at line 84 of file MemPool.cc.
References assert, NULL, and MemPoolIterator::pool.
Referenced by MemPools::clean(), MemPools::flushMeters(), memPoolGetGlobalStats(), and Mem::Report().
| MemImplementingAllocator* memPoolIterateNext | ( | MemPoolIterator * | iter | ) |
Get next pool pointer, until getting NULL pointer.
Definition at line 92 of file MemPool.cc.
References assert, MemImplementingAllocator::next, NULL, MemPoolIterator::pool, and pool.
Referenced by MemPools::clean(), MemPools::flushMeters(), memPoolGetGlobalStats(), and Mem::Report().
| int memPoolsTotalAllocated | ( | void | ) |
Definition at line 345 of file MemPool.cc.
References MemPoolMeter::alloc, MemMeter::level, memPoolGetGlobalStats(), and _MemPoolGlobalStats::TheMeter.
Referenced by statMemoryAccounted().
Search
Introduction
- About Squid
- Why Squid?
- Squid Developers
- How to Help Out
- Getting Squid
- Donate
- Squid Deployment Case-Studies
Documentation
- FAQ | Wiki | Book
- Configuration Reference
- Configuration Guide - Visolve
- Configuration Examples
- Users guide
- Non-English
- Security Advisories
- More...
Support
- Bugzilla Database
- Mailing lists
- Contacting us
- Commercial services
- Project Sponsors
- Squid-based products
