If you've ever coded in C, you're probably familiar with the malloc function, which dynamically allocates memory on the heap at runtime. In this project, I recreated the functionality of malloc from scratch using the mmap system call to request me…
If you’ve ever coded in C, you’re probably familiar with the malloc function, which dynamically allocates memory on the heap at runtime. In this project, I recreated the functionality of malloc from scratch using the mmap system call to request memory directly from the operating system. Building a custom allocator required managing memory blocks manually, including tracking free and allocated regions, handling fragmentation, and implementing strategies for choosing where new allocations should be placed. To explore different allocation behaviors, I implemented several common allocation strategies: first-fit, best-fit, worst-fit, and buddy-fit, and generated graphs exploring each of the strategies’ performance.