Custom memory allocator in C.
- GCC compiler
- Make
- Linux/Unix system (uses POSIX features)
# Clone the repository
git clone https://github.com/tylerguest/memoman.git
cd memoman
# Build with debug output
make debug
# Build optimized for benchmarking
make benchmark
# Build all tests (default with debug flags)
make allmake run# After building
./tests/bin/test_benchmark
./tests/bin/test_<other_test>#include "memoman.h"
// Allocate memory
void* ptr = memomall(size);
// Free memory
memofree(ptr);
// Reset allocator state
reset_allocator();memoman/
├── src/
│   ├── memoman.c      # Allocator implementation
│   └── memoman.h      # Public API
├── tests/
│   ├── test_benchmark.c  # Performance benchmarks
│   └── bin/           # Compiled test binaries
├── Makefile           # Build configuration
└── README.md
- make all- Build all tests with debug flags
- make benchmark- Build optimized for performance testing
- make debug- Build with debug output enabled
- make clean- Remove build artifacts
- make run- Build and run all tests
The benchmark compares the custom allocator against system malloc:
make benchmark
./tests/bin/test_benchmark- DEBUG_OUTPUT- Enable debug logging
- NDEBUG- Disable assertions (benchmark mode)
- -O3 -march=native- Optimization flags for benchmarking