How jessa2005/heap-memory-management-implementation works
HMM is a Linux user-space allocator that replaces the standard allocation API, managing aligned blocks in the process heap via sbrk. The main workflow is a caller requesting memory through the public API or libc-compatible wrappers; allocation searches and splits free blocks, while freeing coalesces neighbors and may return heap space to the OS. Extended operations provide calloc, realloc, and size queries. The graph reflects the sampled allocator sources and README capabilities; static linking and LD_PRELOAD are documented, but their build/configuration details are outside this runtime view.
Main entry points: HmmAlloc.c Allocation · HmmFree.c Free and Coalesce · Hmm.h Public API · heapWrappers.c Libc Wrappers
Components 14
Allocation API
- Public API
inc/Hmm.h - Libc Wrappers
src/heapWrappers.c - Extended Operations
src/HmmEx.c
Heap Management
- Allocation
src/HmmAlloc.c - Heap Alignment
src/HmmAlloc.c - Fit and Split
src/HmmAlloc.c - Heap Expansion
src/HmmAlloc.c - Free and Coalesce
src/HmmFree.c - Heap Contraction
src/HmmFree.c - Block Metadata
inc/hmm_int.h - Free List
inc/hmm_int.h - Physical Links
inc/hmm_int.h
Heap Platform
- Process Break
Other components
- Application
Connections 22
- Application → Libc Wrappers: calls
README.md - Application → Public API: calls
README.md - Libc Wrappers → Allocation: allocates
src/heapWrappers.c - Libc Wrappers → Free and Coalesce: frees
src/heapWrappers.c - Libc Wrappers → Extended Operations: delegates
src/heapWrappers.c - Public API → Allocation: exposes
README.md - Public API → Free and Coalesce: exposes
README.md - Public API → Extended Operations: exposes
inc/Hmm.h - Allocation → Heap Alignment: aligns
src/HmmAlloc.c - Allocation → Fit and Split: searches
src/HmmAlloc.c - Allocation → Heap Expansion: expands
src/HmmAlloc.c - Allocation → Free List: updates
src/HmmAlloc.c - Allocation → Block Metadata: updates
src/HmmAlloc.c - Fit and Split → Physical Links: updates
src/HmmAlloc.c - Free and Coalesce → Free List: updates
src/HmmFree.c - Free and Coalesce → Physical Links: coalesces
src/HmmFree.c - Free and Coalesce → Heap Contraction: contracts
src/HmmFree.c - Extended Operations → Allocation: allocates
src/HmmEx.c - Extended Operations → Free and Coalesce: frees
src/HmmEx.c - Heap Expansion → Process Break: grows
src/HmmAlloc.c - Heap Alignment → Process Break: aligns
src/HmmAlloc.c - Heap Contraction → Process Break: releases
src/HmmFree.c