I wanted to learn more about the under the hood of C.

What it does

It allows the user to allocate blocks of memory, much like malloc.

How I built it

I used sbrk and brk to get pages of memory from the OS. I then had arrays to keep track of what blocks were in use and which ones weren't.

Challenges I ran into

Keeping track of the block layout and "freeing" them properly, as well as knowing minimizing fragmentation.

What I learned

How sbrk/brk work, (a little bit of) how malloc works under the hood.

What's next for Allocator

Write an implementation using mmap

Built With

Share this project: