Skip to content

rafayy769/MemAlloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MemAlloc

MemAlloc is a simple memory allocation library that provides a simple interface for allocating and freeing memory. It is written in C and is designed to be used in embedded systems where memory allocation is a critical task. The library is designed to be small and efficient, with a focus on simplicity and ease of use.

Implements an arena-based memory allocator that uses free-list scheme, and different allocation schemes (next-fit, best-fit, worst-fit) which can be configured to be used based on the set environment variable. Note that non-arena based allocation is also supported, and can be used easily.

A comprehensive test suite is provided to ensure the correctness of the library. The testing is based on traces, generated by a python script, against which the performance of the allocator is tested.

Usage

In order to compile the project, run the following commands:

$ make

By default, it will produce a release build. A debug build can be obtained by running:

$ make BUILD_DEFALUT=debug

The build produces build/libmm_malloc.a which can be linked with the user code. The user code should include the header file mm_lib.h to use the library.

In order to run the tests, generate the traces by running the following command:

$ python3 test/traces/trace_gen.py

It uses the test/traces/trace_config.json file to generate the traces. The traces are generated in the test/traces directory. The traces can be run against the allocator by running the following command:

$ make driver

The driver program will run the traces against the allocator, check for correctness and print the statistics.

About

Poor man's malloc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published