I'm looping through several text files in a cgi-bin program of mine to
accumulate sales data using FreePascal version 2.0.4.
To see if a file exists, I use FindFirst along with the DosError
variable. My cgi-bin crashes (with a 1450 error says the Apache error
log) when looping through a large number of files, but not when looping
through a small number of files.
I became suspicious of the FindFirst procedure in FreePascal and wrote a
test program.
If I open Task Manager and look at the number of I/O handles in use
while the program executes (under the Performance tab), the number grows
until the program ends, but only if the file exists. If the file does
not exist, a number of handles does not grow large (interesting).
Is this a compiler bug? Configuration bug? HW bug? Or how can I free a
handle that FindFirst apparantly uses? Workarounds?
Thanks.
Jim
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROGRAM t2;
USES dos;
VAR
i : longint;
DirInfo : searchRec;
BEGIN {t2}
FOR i:=1 to 500000 DO
BEGIN
findFirst('\VER.TXT',anyfile,dirinfo);
{file must exist - missing files do not show the problem}
IF (i mod 1000)=0 THEN
writeln(i);
END; {endfor}
END. {t2}


|