my application use more and more memory...

magmo

Member
Joined
Oct 19, 2006
Messages
14
Programming Experience
1-3
Hi

I have a windows form built in VS 2003 that use a system.timer to execute scheduled tasks, the program itself works just fine but there is a thing that bothers me, and I cannot understand why. When the program starts it use for example 3400kb mem usage. I see this when I look in the task manager. But the program itself doesn't keep using that amount of memory. Instead it increase by 4-10 kb. And it does that aproximatly every 10 seconds.

Here's the code I use..

VB.NET:
Dim sbTypeOfExecution, sExecuteTime As String
Private t As New System.Timers.Timer
 
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sbTypeOfExecution = Configuration.ConfigurationSettings.AppSettings.Get("sTypeOfExecution")
sExecuteTime = Configuration.ConfigurationSettings.AppSettings.Get("sTimeToExecute")
With t
t.Enabled = True
t.Interval = 1 * 1000 '60 * 1000 '1 minute
t.AutoReset = True
End With
 
AddHandler t.Elapsed, AddressOf TimerFired
 
End Sub
 
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
 
If sbTypeOfExecution = ("Monthly") Then
Select Case e.SignalTime.Day
Case 1
If (Date.Now.ToLongTimeString) = (sExecuteTime) Then
'MsgBox("Timer fired")
RunScheduledProcess()
End If
End Select
End If
 
End Sub

Regards

M
 
Last edited by a moderator:
Don't worry about it - the CLR will manage the memory just fine. The memory useage will probably continue to grow until it is needed for something else and at that point the GC/Windows will release it.
 
Back
Top