Recreation of Malloc banner

Recreation of Malloc

2 devlogs
20h 4m 40s

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.

Demo Repository

Loading README...

amazingme466

I updated the main project to add support for a wider array of malloc strategies while also making the basic functionality of mallocator. The project is now able to complete a wide array of allocations and de-allocations while minimizing fragmentation and accounting for a ton of different edge cases (at the cost of my sanity lol). I’ve attached one of the outputs of my testing to check the speed and performance of different malloc strategies.

Attachment
0
amazingme466

I’m working on my first project! This is so exciting. I can’t wait to share more updates as I build.

Attachment
1

Comments

amazingme466
amazingme466 1 day ago

Honestly, I’ve been working a lot behind the scenes on this, and it seems that I’ve forgotten to post dev logs :(