cleanup memory selection