I am fairly new to VB.NET and I am working with an service that implements a timer. The timer action will do some work and then log success/failures to the event log. I am noticing that each time the event log is written to the memory usage of the executable shown in the task manager increases. It does not increase by much, maybe 20k or so. Is this expected? The code below is an example of what I am doing that is causing the memory to increase.


Thank you very much in advance,
Kyle

Module Module1
    Sub Main()
		Dim Timer1 As Timer = New Timer(1000)
        AddHandler Timer1.Elapsed, AddressOf Timer1_Action
        Timer1.Enabled = True
        Console.ReadLine()
    End Sub
    
    Sub Timer1_action(ByVal source As Object, ByVal e As ElapsedEventArgs)
		Console.WriteLine("Timer Fired")
		EventLog.WriteEntry("Application", "Action Triggered", EventLogEntryType.Information) 
    End Sub
End Module

Well if it is writing to the log on every successful / unsuccessful action then an increase in memory usage can be expected.

- Jordan

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.