Memory fixes

Some optimizations of malloc
Bugfix in memory_init - mask C8000h - EF000h, these are reserved for
some machines