SkillAgentSearch skills...

Malloc

Malloc / Free / Realloc / Calloc implementation using a red-black tree

Install / Use

/learn @sebastiencs/Malloc
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Malloc

malloc(), free(), realloc() and calloc() implementation using a red-black tree. malloc() allocates memory from the heap using sbrk(), according to the memory page size. The default alignment is 8 and 16 bytes on x86 and x86_64 systems, respectively. Mutexes are used to avoid corruption.

Define BEST_FIT during compilation to use best-fit algorithm instead of first-fit algorithm (file malloc.c).

Can be used with any programs but the ones using their own memory allocator. With some systems and some programs, glibc is used, you have to define in the environment G_SLICE=always-malloc.

Example

$ G_SLICE=always-malloc LD_PRELOAD=./libmy_malloc.so gimp | firefox | gdb | ...

View on GitHub
GitHub Stars10
CategoryDevelopment
Updated1y ago
Forks3

Languages

C

Security Score

60/100

Audited on Jul 3, 2024

No findings