How aryan9787/myalloc works
myAlloc is an educational C allocator exposing an_malloc() and an_free(). Callers enter through the public API; allocation initializes the process heap if needed, aligns the request, and delegates block selection and allocation. Freeing validates and releases a block, coalesces adjacent free space, then attempts to shrink the heap. The implementation uses block metadata, sbrk(), and a lock. The README documents these capabilities; the graph’s call edges are based on the excerpted source, not unsampled files.
Main entry points: allocator.c Allocate and free · block.c Block operations · heap.c Heap management · allocator.h Allocator API
Components 8
Public API
- Allocator API
include/allocator.h - Allocate and free
src/allocator.c
Block Management
- Heap metadata
include/allocator_internal.h - Block operations
src/block.c
Heap Runtime
- Heap management
src/heap.c - Heap locking
src/sync.c
Other components
- Allocator callers
- Process heap
Connections 12
- Allocator callers → Allocator API: calls
include/allocator.h - Allocator API → Allocate and free: exposes
include/allocator.h - Allocate and free → Heap management: aligns and initializes
src/allocator.c - Allocate and free → Block operations: allocates and validates
src/allocator.c - Allocate and free → Heap locking: locks heap
src/allocator.c - Allocate and free → Heap management: shrinks after free
src/allocator.c - Block operations → Heap management: extends heap
src/block.c - Block operations → Heap locking: locks heap
src/block.c - Heap management → Block operations: finds prior block
src/heap.c - Allocate and free → Process heap: requests pages
src/allocator.c - Block operations → Process heap: requests pages
src/block.c - Heap management → Process heap: releases pages
src/heap.c