Learning objective
Implementing allocation primitives makes normally hidden details concrete: block bookkeeping, allocation lifetime and the relationship between an address and the storage behind it.
Validation focus
Memory tools help reveal leaks and invalid accesses. Small programs that allocate, use and release multiple blocks provide a practical way to reason about allocator behaviour.
Scope
This is an educational implementation, not a production allocator. The project is intentionally small and complements broader work in C++ systems programming.
EXPLORE THE SOURCE
Explore the implementation
git clone https://github.com/SAED2906/MemoryAllocator.gitCode example
#include "memalloc.h"
#include <iostream>
int main() {
int* values = (int*) malloc(5 * sizeof(int));
if (values == nullptr) return 1;
for (int i = 0; i < 5; ++i) {
values[i] = i + 1;
std::cout << values[i] << '\n';
}
global_free();
return 0;
}