Lines Matching defs:chunk

91 	in this chunk.
108 FreeChunk* chunk
110 chunk->fSize = fSize - splitSize - FreeChunk::NextOffset();
111 chunk->fNext = fNext;
115 return chunk;
119 /*! Checks if the specified chunk touches this chunk, so
123 FreeChunk::IsTouching(FreeChunk* chunk)
125 return chunk
126 && (((uint8*)this + fSize == (uint8*)chunk)
127 || (uint8*)chunk + chunk->fSize == (uint8*)this);
131 /*! Joins the chunk to this chunk and returns the pointer
132 to the new chunk - which will either be one of the
139 FreeChunk::Join(FreeChunk* chunk)
141 if (chunk < this) {
142 chunk->fSize += fSize;
143 chunk->fNext = fNext;
145 return chunk;
148 fSize += chunk->fSize;
149 fNext = chunk->fNext;
159 // find the previous chunk in the list
160 FreeChunk* chunk = pool->free_anchor.fNext;
162 while (chunk != NULL && chunk != this) {
163 previous = chunk;
164 chunk = chunk->fNext;
167 if (chunk == NULL)
179 FreeChunk* chunk = pool->free_anchor.fNext;
181 while (chunk && chunk->Size() < fSize) {
182 last = chunk;
183 chunk = chunk->fNext;
186 fNext = chunk;
222 // try to join the new free chunk with an existing one
225 FreeChunk* chunk = free_anchor.Next();
229 while (chunk) {
230 if (chunk->IsTouching(freedChunk)) {
232 // because the next pointer is inherited by the chunk
233 freedChunk->SetNext(chunk->Next());
234 freedChunk = chunk->Join(freedChunk);
236 // remove the joined chunk from the list
238 chunk = last;
244 last = chunk;
245 chunk = chunk->Next();
303 // declare the whole heap as one chunk, and add it
306 FreeChunk* chunk = (FreeChunk*)pool->heap_base;
307 chunk->SetTo(pool->max_size, NULL);
309 pool->free_anchor.SetTo(0, chunk);
359 FreeChunk* chunk = pool->free_anchor.Next();
361 while (chunk && chunk->Size() < size) {
362 last = chunk;
363 chunk = chunk->Next();
366 if (chunk == NULL) {
367 // could not find a free chunk as large as needed
372 if (chunk->Size() > size + sizeof(FreeChunk) + kAlignment) {
373 // if this chunk is bigger than the requested size,
377 FreeChunk* freeChunk = chunk->Split(size);
380 // re-enqueue the free chunk at the correct position
384 // remove the chunk from the free list
386 last->SetNext(chunk->Next());
391 TRACE("malloc(%lu) -> %p\n", size, chunk->AllocatedAddress());
392 return chunk->AllocatedAddress();
483 FreeChunk* chunk = FreeChunk::SetToAllocated(buffer);
484 // TODO: we currently always return the actual chunk size, not the allocated
486 return chunk->Size();
496 FreeChunk* chunk = FreeChunk::SetToAllocated(buffer);
497 return chunk->Size();