Memory management in preferences window