MyHeap

Deadline: September 28th, 2014

1   Instructions

Implement your own version of C's malloc, realloc and free using only mmap and munmap.

Function Description
my_malloc(x) Allocate x bytes of memory and returns a pointer to the allocated memory. Return 0 if no memory could be allocated. The return address must be sufficiently aligned for C's long and void* data types.
my_free(p) Deallocate the allocation pointed to by p, or do nothing if p is 0.
my_realloc(p, n) Reallocate the memory pointed to by p to fit n bytes of memory instead. Return a pointer to the reallocated memory, or 0 if the reallocation failed.

2   Grading