index1, index2, index3....
Shouldn't index1 itself, be an array?
i.e. index(x), x increments from array to array, in a loop to max arrays you have?
index(1)= no of elements in first index
index(2)= no of elements in second index
That way, you could multiply it out before hand and see if it will overflow the ram you reserved.
AmigaOne! Move to the next dimension of power!