MemoryCleaner test and refactoring