I do not understand why the _PRESERVE field is not memorized as well as the field over REDIM (x, y), but it is written differently.
To make _PRESERVE work across multiple dimensions, think of what it'd have to do:IMHO I think that this algorithm can become more efficient with some modifications using mathematical models...
1) Create a new array of proper size, as before. "000000000000"
2) Calculate how large each chunk of "preserved memory" must be, and move it to the proper place inside the new array....
This step means we move "12" first (one old dimension), so we have "120000000000" in the new array.
Then we calculate the proper position for the next position and move the next chunk of substainable data (the "34"), so we have "120340000000".
Continue to calculate and copy....
"120340560000"
"120340560780"
3)Free old array from memory.
4)Swap pointers.
Personally, I feel it's much better to leave it as it is, and let the user roll their own solution. Then, they can search for a method which will give them the results they need (as you did above), without adversely destroying the performance they'd expect.