Dynamic memory allocator written in C.
This project implements a simplified malloc/free-style allocator with three allocation classes:
- small allocations served from a fixed-size chunk pool;
- medium allocations managed with a buddy allocator;
- large allocations mapped directly with
mmap.
Each allocated block is marked with metadata before and after the user area. This metadata stores the allocation size and kind, and includes a magic value derived from the block address to detect memory overwrites during free.
- Block marking and validation.
- Small allocation pool with recursive-doubling refill.
- Medium-size buddy allocator with block splitting and coalescing.
- Large allocations through direct
mmap/munmap. - Unit tests with GoogleTest.
- Interactive
memshellexecutable for manual allocator inspection.
mkdir -p build
cd build
cmake ..
makeFrom the build directory:
ctest --output-on-failure
make checkExpected result:
12 tests passed
src/ allocator implementation and memshell
tests/ GoogleTest unit tests
AUTHORS project authors
LICENSE license
The allocator is designed for educational purposes. It follows the assignment structure from the Ensimag systems course and focuses on allocator internals: metadata, free lists, buddy splitting, and coalescing.