Delphi TTimer interval limitation
Posted by webmaster Guido on March 14, 2004 at 17:40:19:
In Reply to: Re: Thx and... posted by Joey on March 11, 2004 at 22:17:31:
: With TTimer running does it slowly churn up memery or each cycle does it clean up what it last did??
: So with it set to 1 it wont very very slowly cause my PC to slow down will it??
1. TTimer events do not accumulate memory every time they run, just as any other event doesn't do this. Otherwise, the system would hang very quickly, since so many messages are buzzing around continuously between the OS (Windows) and the applications.
Of course, you could *code* the event handler the wrong way, so that it eats a bit of memory each time, without releasing the previous memory. An example would be: in the OnTimer procedure, create an object of your own, and afterwards forget to free that object:
2. The real resolution of the TTimer interval is limited to 55 milliseconds: the real interval is not what you set, but a multiple of 55. Meaning: if you set it to any value from 1 to 55 it will be 55, 56 to 110 gives 110, and so on.
[ DelphiLand: free Delphi source code, tips, tutorials ]