Basic C heap allocator, including malloc, realloc and free