fix several bugs in the allocator
move global variables in heap class, because somebody might want to create a several heaps
local_free + refactoring