S
Simon
Hi all,
I'm having a baffling problem with a windows service that I'm working on.
Basically, I am using a typed dataset to insert a large number of rows
into an SQL Server 2005 database. But there's a memory leak that seems
to be to do with calling the data adapters update method. It's making
the memory usage go through the roof and ultimately the service crashes
after running out of memory.
I've used ".net memory profiler" to analyse the service. It tells me
that there are huge numbers of undisposed
@List<SQLParamter>.Enumeration@ objects. I'm guessing this is a bad thing.
I don't know what to do about it though. As far as I know, the dataset
table adapter should be cleaning up after itself once the method ends.
In case it helps, a sample of my code would
.... Start a foreach loop
currentRow = tblActiveMessages.NewActiveMessagesRow();
currentRow.DownloadID = currentMessage.ID;
currentRow.TTUReference = currentMessage.VehicleID;
.... Assign more properties
tblActiveMessages.Rows.Add(currentRow);
.... For loop ends
da.Update(tblActiveMessages);
I've tried putting a using statement around both the data table and the
table adapter, but it had absolutely no effect.
Can anyone advise me on what I can do to get rid of these little buggers!
Sincerest thanks to anyone who can help - even a little bit! :-(
Simon
I'm having a baffling problem with a windows service that I'm working on.
Basically, I am using a typed dataset to insert a large number of rows
into an SQL Server 2005 database. But there's a memory leak that seems
to be to do with calling the data adapters update method. It's making
the memory usage go through the roof and ultimately the service crashes
after running out of memory.
I've used ".net memory profiler" to analyse the service. It tells me
that there are huge numbers of undisposed
@List<SQLParamter>.Enumeration@ objects. I'm guessing this is a bad thing.
I don't know what to do about it though. As far as I know, the dataset
table adapter should be cleaning up after itself once the method ends.
In case it helps, a sample of my code would
.... Start a foreach loop
currentRow = tblActiveMessages.NewActiveMessagesRow();
currentRow.DownloadID = currentMessage.ID;
currentRow.TTUReference = currentMessage.VehicleID;
.... Assign more properties
tblActiveMessages.Rows.Add(currentRow);
.... For loop ends
da.Update(tblActiveMessages);
I've tried putting a using statement around both the data table and the
table adapter, but it had absolutely no effect.
Can anyone advise me on what I can do to get rid of these little buggers!
Sincerest thanks to anyone who can help - even a little bit! :-(
Simon