Just a quick dirty implementation of simple memory management. That is implementation of memalloc and free