c# windows 服务程序 内存越来越大

private static System.Timers.Timer timer= new System.Timers.Timer();
private static int inTimer = 0;
private static int time = 1;
public Service1()
{
InitializeComponent();

        timer.Interval = time * 60 * 1000;//默认每1分钟执行一次
        timer.Enabled = true;
        timer.Elapsed += new System.Timers.ElapsedEventHandler(TimedEvent);
        timer.AutoReset = true;

    }
            private void TimedEvent(object sender, System.Timers.ElapsedEventArgs e)
    {
                 读取表数据,
                     循环修改,
                // GC.Collect();
        //GC.WaitForPendingFinalizers();
            }

把实际要做的事情再做一个程序,命令行传参数给它,每执行一次就退出。

内存会越来越大?我的怎么没有呀,而且我的数据比你的大多了,很可能是你用的一些变量没有释放导致了,要多用using;你要是觉得有问题可以写个控制台程序,然后使用windows自带的定时任务执行

内存越来越大,是不是你读取数据和修改的数据集什么的没有清空