| 24 | } |
| 25 | |
| 26 | void* TriPoolAllocator::Allocate( size_t size ) |
| 27 | { |
| 28 | // Align size to 16 bytes - pool starts out 16byte aligned - this ensures |
| 29 | // that all allocations are always 16 byte aligned. |
| 30 | size = CCP_ALIGN( size, 16 ); |
| 31 | |
| 32 | if( m_poolCurrent + size > m_poolEnd ) |
| 33 | { |
| 34 | GetMoreSystemMemory( size ); |
| 35 | if( m_poolCurrent + size > m_poolEnd ) |
| 36 | { |
| 37 | return NULL; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | void* ret = m_poolCurrent; |
| 42 | |
| 43 | m_poolCurrent += size; |
| 44 | m_totalBytesAllocated += size; |
| 45 | |
| 46 | return ret; |
| 47 | } |
| 48 | |
| 49 | void TriPoolAllocator::Clear() |
| 50 | { |
no outgoing calls
no test coverage detected