Hello All,
We have a small .NET 2.0 Windows Forms application written in C# under maintenance that reads every 10 seconds a CVS file (150-200K) of 2500+ records into an Access database and presents the records on screen in a DataGridView that is bound to a DataTable. It uses the BackGroundWorker component that in the DoWork event reads the CVS file, updates the database and selects the (new) records from the database into a DataTable. When it is done the RunWorkerCompleted event picks up the DataTable from the arugment passed to it and binds the DataTable to the DataGridView. During runtime we've noticed an increase in memory usage of aprox. 5-10 MB every hour. The memory consumption grows and our customer says that after a day or two (without restarting the application) it is roughly 200MB. Also the user infterface seems less responsive.
There is little to no time to do a redesign of the application at this moment. So, we are trying to solve the memory leak (because that's what it seems) the quickest way possible in the current code base.
I'm not exactly sure but I've seen a memory increase without release every time the Access database is being accessed. I looked at the code but the OleDbConnection instances are guarded with using-statements and every connection is also explicitly closed. No transactions are being used. The only thing different, perhaps, is the fact that it is being run on a seperate thread served from the thread pool (the BackGroundWorker component at work). Could this be the bottle-neck?
I had a discussing the other day and someone argued that the increase in memory usage (without release) doesn't necessarily mean that it is a memory leak (in .NET applications). He says that the memory will eventually be released if the GC thinks it is time to do so meaning that if the systems can handle it the application may allocate 500MB or even more... I'm not sure about this.
Any comments are very much appreciated,
Thanks,
Johan.
We have a small .NET 2.0 Windows Forms application written in C# under maintenance that reads every 10 seconds a CVS file (150-200K) of 2500+ records into an Access database and presents the records on screen in a DataGridView that is bound to a DataTable. It uses the BackGroundWorker component that in the DoWork event reads the CVS file, updates the database and selects the (new) records from the database into a DataTable. When it is done the RunWorkerCompleted event picks up the DataTable from the arugment passed to it and binds the DataTable to the DataGridView. During runtime we've noticed an increase in memory usage of aprox. 5-10 MB every hour. The memory consumption grows and our customer says that after a day or two (without restarting the application) it is roughly 200MB. Also the user infterface seems less responsive.
There is little to no time to do a redesign of the application at this moment. So, we are trying to solve the memory leak (because that's what it seems) the quickest way possible in the current code base.
I'm not exactly sure but I've seen a memory increase without release every time the Access database is being accessed. I looked at the code but the OleDbConnection instances are guarded with using-statements and every connection is also explicitly closed. No transactions are being used. The only thing different, perhaps, is the fact that it is being run on a seperate thread served from the thread pool (the BackGroundWorker component at work). Could this be the bottle-neck?
I had a discussing the other day and someone argued that the increase in memory usage (without release) doesn't necessarily mean that it is a memory leak (in .NET applications). He says that the memory will eventually be released if the GC thinks it is time to do so meaning that if the systems can handle it the application may allocate 500MB or even more... I'm not sure about this.
Any comments are very much appreciated,
Thanks,
Johan.