Implementation of malloc, realloc, and free