memalloc
memalloc copied to clipboard
A simple memory allocator - Memory allocation 101
From Linux manual of realloc: > If ptr is NULL, then the call is equivalent to malloc(size), for all values of size; if size is equal to zero, and ptr...
Calling malloc from realloc with a size of 0 will return NULL. Remove call to malloc in realloc.
The previous implementation releases only the last element. The new implementation releases all free elements that are trailing. Test 1 => * make allocations * remove them FiLo (inverted order...
“sbrk() with a negative argument decrements the program break. So memory is released by the program to OS.” these words may not really true. when sbrk(-N) happens in the same...
It mostly works with ls, though. I wanted to debug it but gdb segfaults immediately as well.