Skip to content

prak132/Memory-Allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Custom Memory Allocator

Compilation

Compile the memory allocator using the following command:

gcc -o memalloc.so -fPIC -shared -Wno-deprecated-declarations memalloc.c

Compile the memory allocator with the stress test:

gcc -o stress_test stress_test.c malloc.c -pthread

Usage

Assuming you are using a Unix-type operating system, follow these steps to use the custom memory allocator when running commands:

export LD_PRELOAD=$PWD/memalloc.so

This sets the LD_PRELOAD environment variable to the path of the compiled memalloc.so shared library.

Stop Using the Memory Allocator

To stop using the custom memory allocator, simply run:

unset LD_PRELOAD

This unsets the LD_PRELOAD environment variable, reverting to the default memory allocation behavior.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages