I use dynamic arrays a great deal and have no problems with the SetLength and Finalize procedures.
I recently had cause to use dynamic arrays where each array element could itself contain a variable number of elements. The declaration is like this:
TScheduleArray = array of array of array [1..DaysPerWeek] of TShiftType;
The software is working fine, I've not got a problem with how to use this structure. You call SetLength on the main array and then can call SetLength again on each array element. This is working as expected.
SetLength(MyArray, 1);
SetLength(MyArray[0], 2);
My question is this: When I come to free up the resources used for this array, do I just call Finalize on the array variable:
Finalize(MyArray);
or does each array element also need to be Finalized, as each element is a dynamic array itself?