views:

21

answers:

0

I'm currently creating a windows service that will do some update on the database and send email on a timely manner. My issue is that as i run the service, the memory usage increases by 8kb (starts by 18,000kb+) and I'm not sure if it is normal as it would increase after some months/years. I removed any calls from database as well as sending emails, but it still the same. Below is the callback of my timer:

private void ActionExecute(Object state)
    {
        if (DateTime.Now.Hour == Settings.Refresh.Hour &&
            DateTime.Now.Minute == Settings.Refresh.Minute &&
            DateTime.Now.Second == 0)
        {
            Settings.Refresh.ToString().Log();
        }


        if (DateTime.Now.Hour == Settings.ExecDateTime.Hour &&
            DateTime.Now.Minute == Settings.ExecDateTime.Minute &&
            DateTime.Now.Second == 0)
        {
            Settings.ExecDateTime.ToString().Log();
        }
    }

This is my logging extension method, for testing purposes i just logged the output.

public static class Extensions
{
    public static void Log(this String item)
    {
        using (var log = new EventLog())
        {
            log.Source = "Sample Project";
            log.WriteEntry(item);
        }
    }
}

Is this a normal behavior of windows services?

Thanks!