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 ) );
189 pItem = pChunk->freeList.First();
191 pChunk->freeList.RemoveFirst();
196 return reinterpret_castT*>(pItem);
203 FreeBlock* pItem =
reinterpret_castFreeBlock*>(pObj);
205 PoolChunk* pPrevChunk =
NULL;
206 PoolChunk* pChunk = m_chunkList.
First();
207 while (pChunk !=
NULL && !pChunk->BelongsTo(pItem))
210 pChunk = pChunk->pNextLightItem;
214 pChunk->freeList.AddFirst(pItem);
217 if (pChunk->AllFree())
220 pChunk->~PoolChunk();
226 tChunkList m_chunkList;
228 #ifdef AK_DYNA_BLK_STATS
231 uCurrentUsedBytes +=
sizeof(T);
232 uPeakUsedBytes =
AkMax(uCurrentUsedBytes, uPeakUsedBytes);
234 void Stats_NewChunk()
236 uCurrentAllocdBytes +=
sizeof(PoolChunk);
237 uPeakAllocdBytes =
AkMax(uCurrentAllocdBytes, uPeakAllocdBytes);
241 uCurrentUsedBytes -=
sizeof(T);
243 void Stats_DelChunk()
245 uCurrentAllocdBytes -=
sizeof(PoolChunk);