[DUG] Creating lots of files on slow machines

John Bird johnkbird at paradise.net.nz
Thu Apr 12 14:52:15 NZST 2012


I came across an oddity in a program that creates lots (eg 30,000+) files exporting selected data from a database.

Some files disappear on slower PCs  even though they are created.
  a.. Files are created in a thread using TFilestream, in a loop 
  b.. Each file is being checked that it gets created using a if FileExists(filename) in the loop and they always seem to be there. 
  c.. Files are written at the rate of around 20-30 per second and are mostly around 3KB in size. 
  d.. At the end of the big loop a list of files created is created by the usual FindNext code. 
  e.. On some slower PC’s (XP or Server 2003) some files are missing.  Faster PC’s with Win7 have all the files.  All PC’s are VMs. 
  f.. Files missing might range from 10 to 500, never the same number 
  g.. The problem can be cured by putting a 2 millisecond sleep between creating each file.  1 Millisecond is not enough.
Can anyone shed any light on why this might be the underlying issue and why a sleep might fix it?

John Bird
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20120412/78b9aaba/attachment.html 


More information about the Delphi mailing list