use copyMemory