Memory leak fixes for AtomFactoryMethod.