Skip to content

brazhenko/ft_malloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Malloc

Malloc is a C pet-project from 42 course (task is available here).

About

This project was written to build your own thread-safe allocator (malloc/realloc/free) using system calls and learn some allocation algorithms.

Some info I was inspired by 1.
Some info I was inspired by 2.

Interface

void		*malloc(size_t size);
void		*realloc(void *ptr, size_t size);
void		free(void *ptr);

void		show_alloc_mem();
void 		show_mem_hex();

Download

If you want to build only libft_malloc

git clone [ref]

If you want to build allocation Visualizer

git clone --recursive [ref]

Build libft_malloc.so

make
#
ls -l
lrwxr-xr-x   1 a17641238  staff       29 Apr 22 16:49 libft_malloc.so -> libft_malloc_x86_64_Darwin.so
-rwxr-xr-x   1 a17641238  staff    27680 Apr 22 16:49 libft_malloc_x86_64_Darwin.so

Build allocation visualizer

brew install glfw3
brew install cmake 
cd Visualizer
cmake . && make

Usage of libft_malloc.so

gcc main.c -L$DIR -lft_malloc.so

OR

./run.sh /usr/bin/time -l ./bin # you can inject library by hand.

Usage of allocation Visualizer

# start it after the program used libft_malloc.so exited
./AllocViewer

example 2

example 2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published