Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deletion of DelX.MB files

Status
Not open for further replies.

JamieKitson

Programmer
Oct 18, 2003
7
GB
Hi,

I have a program that, for the sake of a short post, runs a few queries in a loop. Running the loop once every 10 seconds is ok, some DelX.MB files get created and deleted in the temporary folder. However, if the loop runs too fast, about once every 3 seconds, some of the DelX.MB files are not deleted and my program eventually raises either the MaxFileHandles or Out of Memory error. If the program pauses for some reason then the files get deleted and it runs ok for a bit longer. I know I can put the MaxFileHandles and SharedMemSize values up but I cannot put them up indefinitely. Is there anyway I can speed up the deletion of these files? Is it a BDE problem or a problem with Windows disk access?

Any help much appriciated, Jamie Kitson

 
Do you have "application.processmessages" anywhere in your loop? That's what will give Windows the prompt to handle other things besides your loop. I would not necessarily use it in every iteration of the loop, but maybe every 10th time it runs or less frequently. You can set up a counter to control this, something like this:
Code:
if i = 10 then
begin
  application.processmessages;
  i := 0;
end
else
  inc(i);
Because this does take some time, you'll probably want to play with different values in the counter to determine where the balance is between the speed of the loop and yet calling application.processmessages enough to alleviate the problem.

-Dell
 
Thanks for your reply. The loop's quite a bit more complicated than that, and it turns out it's as simple as the queries not being freed early enough.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top