How rn-ops/memory-allocator-in-c works
This is a cross-platform, page-backed C allocator intended to provide malloc, calloc, realloc, and free. The principal workflow enters through the allocator API, which looks for a free block or requests page-aligned memory from the OS layer, then returns a user pointer; calloc and realloc reuse allocator operations. Block metadata and the explicit free list support allocation and release. The README marks several allocator features as in progress, and the excerpts do not show how platform backends are selected or resolve a mismatch between the allocator’s free-list lookup and the provided implementation.
Main entry points: allocator.c Allocation runtime · os.h OS memory interface · allocator.h Public allocator interface · block.c Block metadata
Components 9
Allocator API
- Allocation runtime
src/allocator.c - Public allocator interface
include/allocator.h
Block Management
- Block metadata
src/block.c - Explicit free list
src/free_list.c - Alignment utilities
src/utils.c
OS Abstraction
- OS memory interface
src/os/os.h - Linux backend
src/os/linux.c - Windows backend
src/os/windows.c
Other components
- Allocator caller
Connections 8
- Allocator caller → Allocation runtime: calls allocation API
README.md - Allocation runtime → Public allocator interface: uses block definitions
src/allocator.c - Allocation runtime → OS memory interface: requests pages
src/allocator.c - Allocation runtime → Block metadata: initializes and checks
src/allocator.c - Allocation runtime → Explicit free list: searches and updates
src/allocator.c - Allocation runtime → Allocation runtime: reuses allocation operations
src/allocator.c - OS memory interface → Linux backend: dispatches on Linux
README.md - OS memory interface → Windows backend: dispatches on Windows
README.md