clear memory early by swap trick