Skip to content

kundurz/blockfit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blockfit

This repository implements a basic block-based heap allocator in C to illustrate core ideas in dynamic memory management.

The allocator manages a fixed-size heap using a doubly linked list of metadata blocks and provides heap_alloc and heap_free.

Features

  • Fixed-size heap (HEAP_SIZE)
  • Fixed-size blocks (BLOCK_SIZE)
  • Metadata stored separately from heap payload
  • First-fit contiguous block allocation
  • Allocation tracking via allocation IDs
  • Heap memory obtained using mmap

Heap Layout

A single mmap region is logically divided into:

  1. Metadata region: an array of block_metadata structures
  2. Heap region: the memory returned to the caller

Each metadata entry corresponds to exactly one fixed-size heap block.

About

A minimal heap allocator using fixed-size blocks and explicit metadata, backed by mmap.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages