| 651 | } |
| 652 | |
| 653 | void freeSlot(RegionAllocHeader* alloc, RegionAllocHeader* next, MemoryBlock* block) |
| 654 | { |
| 655 | block->sizeFree += alloc->size; |
| 656 | |
| 657 | assert(alloc->free == 0); |
| 658 | if (next && next->free) // Then try merging the current and next. |
| 659 | { |
| 660 | assert(next->free == 1); |
| 661 | // Remove the next block from the freelist. |
| 662 | removeHeaderFromFreelist(block, next); |
| 663 | |
| 664 | // Merge |
| 665 | alloc->size += next->size; |
| 666 | block->count--; |
| 667 | } |
| 668 | // Then add the new item to the free list. |
| 669 | insertBlockIntoFreelist(block, alloc); |
| 670 | } |
| 671 | |
| 672 | u64 alloc_align(u64 baseSize) |
| 673 | { |
no test coverage detected