[DUG] Creating lots of files on slow machines
Steve Peacocke
steve at peacocke.net
Thu Apr 12 14:59:39 NZST 2012
Hi John,
All I can say is that I came across this before and resolved it in much the
same way. I looked up the issue at the time and there was some convoluted
explanation but in the end I just put it down to the programmer (me) being
so fast that even a computer couldn't keep up. I could live with that
explanation.
This was about 10 years ago.
Steve
On Thursday, 12 April 2012, John Bird wrote:
> 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.
>
> - Files are created in a thread using TFilestream, in a loop
> - Each file is being checked that it gets created using a if
> FileExists(filename) in the loop and they always seem to be there.
> - Files are written at the rate of around 20-30 per second and are
> mostly around 3KB in size.
> - At the end of the big loop a list of files created is created by the
> usual FindNext code.
> - 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.
> - Files missing might range from 10 to 500, never the same number
> - 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
>
--
Steve Peacocke
Mobile: 0220 612-611
Linkedin Professional
Profile<http://nz.linkedin.com/pub/steve-peacocke/1/a06/489>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20120412/00204af7/attachment.html
More information about the Delphi
mailing list