Skip to content

Memory allocator which is custom implementation of malloc(),calloc(),free() and realloc() using sbrk() system call .

Notifications You must be signed in to change notification settings

Megatrone750/Memory-Allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Memory Allocator

Simple memory allocator which is custom implementation of malloc(),calloc(),free() and realloc() using sbrk() system call .

Screenshots

App Screenshot

Run Locally

Clone the project

  https://github.com/Megatrone750/Memory-Allocator.git

Go to the project directory

  cd Memory-Allocator

Compile the code and make the shared library

   gcc -o memalloc.so -fPIC -shared memalloc.c

On Linux, setting the LD_PRELOAD environment variable to the path of a shared object ensures that the specified file is loaded before any other library. This technique can be leveraged to load a custom-compiled library first, allowing subsequent commands in the shell to utilize your implementations of functions like malloc(), free(), calloc(), and realloc().

  export LD_PRELOAD=$PWD/memalloc.so

Once you've set up LD_PRELOAD with your custom memory allocator library, you can test it by running a standard program like ls. If the library is working correctly, you should see output or behavior indicating that your custom malloc(), free(), calloc(), and realloc() functions are being used.

  ls
   memalloc.  memalloc.so 

unset LD_PRELOAD to make undo changes

  unset LD_PRELOAD

About

Memory allocator which is custom implementation of malloc(),calloc(),free() and realloc() using sbrk() system call .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages