Implement memoryAvailable
First attempt at realloc, may be buggy