A custom memory allocation library implemented in C++ .
Implemented malloc(), free(), calloc() and realloc() from scratch using Linux system calls (sbrk, mmap).
- Basic memory allocation using sbrk()
- Metadata structs attached to each allocation
- Free block reuse with linked list
- Implemented: smalloc, sfree, scalloc, srealloc
- Buddy memory allocation system
- Blocks always sized as powers of 2
- Block splitting on allocation
- Block merging on free
- mmap() for large allocations (128KB+)
smalloc— allocate memorysfree— free memoryscalloc— allocate zeroed memorysrealloc— reallocate memory
C++ · sbrk · mmap · Virtual Memory · Buddy Allocator · Memory Management