C# How do I "free" my timer() ?

Joined
Jan 10, 2007
Messages
43,898
Location
In The Machine
This code :

Timer RESPONSETIMER = new Timer();
RESPONSETIMER.Enabled = false;
RESPONSETIMER.Interval = 4000;
_ClassDoSomething*DoSomething = new _ClassDoSomething();
RESPONSETIMER.Elapsed += new ElapsedEventHandler(DoSomething._DoThis);
RESPONSETIMER.Enabled = true;


Is inside a windows service application. The code is also inside a timer which repeats itself every minute.

The result is that the above code runs every minute.

Since I use Timer RESPONSETIMER = new Timer(); and keep repeating it each minute, I am wondering will this keep eating*up memory?

How do I free "RESPONSETIMER" once "_DoThis" is done?

Is it possible to free the created*"RESPONSETIMER" from within itself via "_DoThis" which runs inside that timer?

More...

View All Our Microsoft Related Feeds
 
Back
Top