
void *malloc(size_t size) { size_t blk_size = ALIGN(size + SIZE_T_SIZE); size_t *header = sbrk(blk_size); *header = blk_size | 1; // mark allocated bit return (char *)header + …
In this project you will be writing a dynamic storage allocator for C programs, i.e., your own version of the malloc(), free() and realloc() routines. You are tasked with implementing a first-fit …
Multiples of largest granularity or smallest block size. What if the “correct” free list is empty? Can just look in the next larger class.
Memory Management with mmap malloc What if we use mmap instead of malloc always?
How do you tell which superblock an object is from? Just mask out the low 13 bits! Simple math can tell you where an object came from! Why are objects re-allocated most-recently used first? …
- [PDF]
malloc - Wellesley
What data structures could we use to track this? Pages (OS-provided) too coarse-grained for allocating individual objects. Instead: flexible-sized, word-aligned blocks. Programmer does …
Recitation 10: Malloc Lab What’s malloc? A function to allocate memory during runtime (dynamic memory allocation). More useful when the size or number of allocations is unknown until …