I'm rewriting an application that has worked a long time and well using static arrays but we now need to handle much larger data sets of variable size: The app is a statistical analysis program and in the course of the analysis process I transform the data through about 50 arrays - most of type extended.
As different sets of data are loaded for processing I size the collection of dynamic arrays with a procedure that includes sets of lines like this: (one for eacy of the many arrays) Many of the arrays are two dim as shown below - some are single dim - but all are of varrying size depending on the data set.
if isRaDc<>nil then isRaDc:=nil;
SetLength(isRaDc, cpnts, creps); // [0..callibration_pnts, 0..callibration_reps] of Extended;
for I := 0 to high(isRaDc) do for j := 0 to high(isRaDc[i]) do isRaDc[i,j]:=0.0;
In the above lines - if I leave out the nil statement I soon get an "out of memory" error after several runs.
If I include it - either with or without several different ways of making it conditional, I get an "illegal pointer operation error" upon the second or third run - depeding on the arrays sizing.
Should I be doing something to force garbage collection after each run - If so I have no idea how?