Generalising MemoryManager class.