This repository contains a custom memory allocator written in C, designed to replace the standard POSIX malloc family at runtime using LD_PRELOAD.
The allocator is based on a slab-oriented approach for small allocations, combined with a dedicated mechanism for larger memory requests. The goal of this project is to provide a clear, structured, and functional implementation of a memory allocator, with an emphasis on readability and coherence rather than production-level optimization.
A complete and detailed technical explanation of the allocator design, architecture, and implementation is available in the following document:
→ malloc.pdf
This document presents the full rationale, internal structure, and design choices in a scientific report format.
make
LD_PRELOAD=./libmalloc.so <your_program>The shared library libmalloc.so overrides the standard allocation functions (malloc, calloc, realloc, free) for the executed program.
Run the test suite:
make checkClean the build files:
make clean- This project is intended as a learning and research-oriented implementation.
- It focuses on clarity and determinism rather than performance or scalability.
- It is not intended to replace production-grade allocators.