delphidelphi-2010memory-managementcpu-usageidle-processing

Safest way to idle delphi application to wait for timer?


I am doing a delphi application that will run on my pc 24/7 in the background and will check if it has to do some actions or not, wait 30 minutes and check again, and so on.

How can I make sure the application will not overload cpu or memory because of being running all the time.


Solution

  • Most programming languages have a "sleep" function that you can call to make the program stop doing stuff.

    You are in control of the memory usage; you can deallocate your memory before going to sleep and reallocate it when coming awake, but...

    It might be better to just set up some recurring job. I don't know how to do this, but I suspect there's a way with Windows Scripting Host to just launch your application on whatever schedule you want.