I have a bunch of files to process, each will have a different number of items to deal with.
define some dynamic arrays
var array1, array2, array3: array of double;
open the first file and scan through it to determine how many data items to process
allocate memory for each array
SetLength(array1,count);
SetLength(array2,count);
SetLength(array3,count);
do my thing and read and process the data for one file...
Now, my question is, to zero/release those arrays in preparation for the next file, is it corrrect to free the space used for those arrays like this:
SetLength(array1,0);
SetLength(array2,0);
SetLength(array3,0);
and then get ready to do it all over again for the next file? If not, what is the best technique to release memory before re-allocating to the new, most likely different, size for the next file? And how about releasing all memory used at the end of the job upon exit?
Thanks
Bob
define some dynamic arrays
var array1, array2, array3: array of double;
open the first file and scan through it to determine how many data items to process
allocate memory for each array
SetLength(array1,count);
SetLength(array2,count);
SetLength(array3,count);
do my thing and read and process the data for one file...
Now, my question is, to zero/release those arrays in preparation for the next file, is it corrrect to free the space used for those arrays like this:
SetLength(array1,0);
SetLength(array2,0);
SetLength(array3,0);
and then get ready to do it all over again for the next file? If not, what is the best technique to release memory before re-allocating to the new, most likely different, size for the next file? And how about releasing all memory used at the end of the job upon exit?
Thanks
Bob