Skip to content

Maybe1or0/malloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language Standard Build System Status Threading Platform

Overview

This repository contains a custom memory allocator written in C, designed to replace the standard POSIX malloc family at runtime using LD_PRELOAD.

The allocator is based on a slab-oriented approach for small allocations, combined with a dedicated mechanism for larger memory requests. The goal of this project is to provide a clear, structured, and functional implementation of a memory allocator, with an emphasis on readability and coherence rather than production-level optimization.

Documentation

A complete and detailed technical explanation of the allocator design, architecture, and implementation is available in the following document:

malloc.pdf

This document presents the full rationale, internal structure, and design choices in a scientific report format.

Build and Usage

make
LD_PRELOAD=./libmalloc.so <your_program>

The shared library libmalloc.so overrides the standard allocation functions (malloc, calloc, realloc, free) for the executed program.

Testing

Run the test suite:

make check

Clean

Clean the build files:

make clean

Notes

  • This project is intended as a learning and research-oriented implementation.
  • It focuses on clarity and determinism rather than performance or scalability.
  • It is not intended to replace production-grade allocators.

About

This repository contains a deterministic general-purpose memory allocator based on slab caches. It is compatible with the POSIX malloc family and focuses on predictable layouts, clear synchronization, and concise code. The design is inspired by Bonwick’s object-caching approach and follows the same technical style as the related TFG report.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Contributors