diff options
Diffstat (limited to 'sp/src/public/tier1/mempool.h')
| -rw-r--r-- | sp/src/public/tier1/mempool.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/sp/src/public/tier1/mempool.h b/sp/src/public/tier1/mempool.h index 88406fbf..01d3a33f 100644 --- a/sp/src/public/tier1/mempool.h +++ b/sp/src/public/tier1/mempool.h @@ -30,19 +30,27 @@ typedef void (*MemoryPoolReportFunc_t)( PRINTF_FORMAT_STRING char const* pMsg, ... ); +// Ways a memory pool can grow when it needs to make a new blob: +enum MemoryPoolGrowType_t +{ + UTLMEMORYPOOL_GROW_NONE=0, // Don't allow new blobs. + UTLMEMORYPOOL_GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates + // get larger and larger each time it allocates one). + UTLMEMORYPOOL_GROW_SLOW=2 // New blob size is numElements. +}; + class CUtlMemoryPool { public: - // Ways the memory pool can grow when it needs to make a new blob. + // !KLUDGE! For legacy code support, import the global enum into this scope enum MemoryPoolGrowType_t { - GROW_NONE=0, // Don't allow new blobs. - GROW_FAST=1, // New blob size is numElements * (i+1) (ie: the blocks it allocates - // get larger and larger each time it allocates one). - GROW_SLOW=2 // New blob size is numElements. + GROW_NONE=UTLMEMORYPOOL_GROW_NONE, + GROW_FAST=UTLMEMORYPOOL_GROW_FAST, + GROW_SLOW=UTLMEMORYPOOL_GROW_SLOW }; - CUtlMemoryPool( int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); + CUtlMemoryPool( int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL, int nAlignment = 0 ); ~CUtlMemoryPool(); void* Alloc(); // Allocate the element size you specified in the constructor. @@ -103,7 +111,7 @@ protected: class CMemoryPoolMT : public CUtlMemoryPool { public: - CMemoryPoolMT(int blockSize, int numElements, int growMode = GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} + CMemoryPoolMT(int blockSize, int numElements, int growMode = UTLMEMORYPOOL_GROW_FAST, const char *pszAllocOwner = NULL) : CUtlMemoryPool( blockSize, numElements, growMode, pszAllocOwner) {} void* Alloc() { AUTO_LOCK( m_mutex ); return CUtlMemoryPool::Alloc(); } |