change MemoryManager to global and init only once.