90 inline bool BelongsTo( FreeBlock* pMem )
const {
return (
AkUInt8*)pMem >= memory && (
AkUInt8*)pMem
91 inline bool AllFree()
const {
return freeList.Length() == uPoolChunkSize; }
92 inline bool AllAllocd()
const {
return freeList.IsEmpty(); }
94 AkUInt8 memory[ kChunkMemoryBytes ];
95 PoolChunk* pNextLightItem;
121 templatetypename A1,
typename A2>
129 templatetypename A1,
typename A2,
typename A3>
130 T*
New(A1 a1, A2 a2, A3 a3)
137 templatetypename A1,
typename A2,
typename A3,
typename A4>
138 T*
New(A1 a1, A2 a2, A3 a3, A4 a4)
153 m_chunkList.
Transfer(in_src.m_chunkList);
155 #ifdef AK_DYNA_BLK_STATS
156 uPeakUsedBytes = in_src.uPeakUsedBytes;
157 uPeakAllocdBytes = in_src.uPeakAllocdBytes;
158 uCurrentAllocdBytes = in_src.uCurrentAllocdBytes;
159 uCurrentUsedBytes = in_src.uCurrentUsedBytes;
161 in_src.uPeakUsedBytes = 0;
162 in_src.uPeakAllocdBytes = 0;
163 in_src.uCurrentAllocdBytes = 0;
164 in_src.uCurrentUsedBytes = 0;
171 FreeBlock* pItem = NULL;
172 PoolChunk* pChunk = NULL;
174 pChunk = m_chunkList.
First();
175 while (pChunk != NULL && pChunk->AllAllocd())
176 pChunk = pChunk->pNextLightItem;
180 pChunk = (PoolChunk *) TAlloc::Alloc(
sizeof( PoolChunk ) );
191 pItem = pChunk->freeList.First();
193 pChunk->freeList.RemoveFirst();
198 return reinterpret_castT*>(pItem);
205 FreeBlock* pItem =
reinterpret_castFreeBlock*>(pObj);
207 PoolChunk* pPrevChunk = NULL;
208 PoolChunk* pChunk = m_chunkList.
First();
209 while (pChunk != NULL && !pChunk->BelongsTo(pItem))
212 pChunk = pChunk->pNextLightItem;
216 pChunk->freeList.AddFirst(pItem);
219 if (pChunk->AllFree())
222 pChunk->~PoolChunk();
228 tChunkList m_chunkList;
230 #ifdef AK_DYNA_BLK_STATS
233 uCurrentUsedBytes +=
sizeof(T);
234 uPeakUsedBytes =
AkMax(uCurrentUsedBytes, uPeakUsedBytes);
236 void Stats_NewChunk()
238 uCurrentAllocdBytes +=
sizeof(PoolChunk);
239 uPeakAllocdBytes =
AkMax(uCurrentAllocdBytes, uPeakAllocdBytes);
243 uCurrentUsedBytes -=
sizeof(T);
245 void Stats_DelChunk()
247 uCurrentAllocdBytes -=
sizeof(PoolChunk);