This project implements a custom memory allocator in C, providing functions similar to the standard malloc, and free. The allocator manages memory blocks using a doubly linked list structure, preventing making many syscalls to as memory is allocated and deallocated.
This project was developed soley for learning purposes and should not be used in production code.
The allocator requests a 8MB chunk of memory via VirtualAlloc syscall and manages this memory internally. It uses a doubly linked list to keep track of allocated and free memory blocks. Each block contains metadata including its size, status (free or allocated), and memory location.
Each memory block is inserted into the linked list in order such that when a block is freed, it can be coalesced with adjacent free blocks to reduce fragmentation.
When allocating memory the allocator searches for the first free block that is large enough to satisfy the request. If a suitable block is found, it is split if necessary, and the requested memory is returned to the user.