Replacing memory allocations

Instead of using stdlib memory allocations we will use our wrappers, that way we don't have to worry about memory errors.
This has the side effect of aborting the program if we run out of memory.