Skip to content

31cmTrueDamage/custom-memory-allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Custom Memory Allocator in C

GitHub last commit GitHub repo size License

Given my interest on low-level stuff i decided to build a custom memory allocator written in C, implementing my not so good versions of:

  • my_malloc – allocate memory
  • my_calloc – allocate zero-initialized memory
  • my_realloc – resize allocated memory
  • my_free – free memory
  • print_heap – visualize the heap structure

Supports aligned memory, block splitting, and merging for efficient memory management.


🔹 Features

  • Fully functional malloc/calloc/realloc/free replacements
  • Heap visualization via print_heap()
  • Splitting & merging blocks to reduce fragmentation
  • Aligned memory support (16-byte alignment by default)

📦 Usage

1. Clone the repository

git clone https://github.com/your-username/custom-allocator.git
cd custom-allocator
gcc start.c my_malloc.c my_calloc.c my_realloc.c helpers.c free.c debug.c -o start
./start

About

A custom memory allocator i did on a thursday

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages