Hi everyone!

I am currently working through an older codebase in FPC (2.6.4, exclusively
on Linux and x86_64 target) that I will have to maintain. My task is to fix
some bugs and make things more efficient if possible. Now, one program uses
TGZFileStream to read from a lot (say, 1000 or more files) one by one. In
the code, there is

[1] FStream := TGZFileStream.Create(FFileNames[i], gzOpenRead);

to open the files. When the stream ends and the next file is going to be
opened, there is

[2] FreeAndNil(FStream);

followed by another [1] with incremented i. The same FStream variable is
reused. But that should be no problem after FreeAndNil(), right? My problem
is that during the whole run time, file handles are never freed. At least

ls -l /proc/PID/fd

shows all files still open, and so does lsof.

Is that a bug in TGZFileStream or am I missing something? I think I can
provide a minimal working example, but maybe the question can be answered
without...

Thanks a lot, and best regards!
Dimitri
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to