Instead of doing all the copying, if you are purposefully getting rid of array a, can't you do b:=a; ? It would be pointer assignment, so doing setlength(a, 0); afterwards, would also wipe clean b. But something like a:=nil; ... this just goes to guessing, but i'm assuming its sort of how it works.