S
Simon
Hi all,
I have a huge memory leak problem in what is really very simple data
insert code.
In my app I'm trying to use a typed dataset to insert into a database.
It adds quite a few rows (say hundreds). Unfortunately it has a big ass
memory leak and I dont understand why.
The code below demonstrates the memory leak. It's like nothing is
cleaned up after PerformOperation is called.
According to .net memory profiler, after running the console app, there
are huge numbers of undisposed objects and meory usage is through the roof.
I've tried to attach a screenshot from .net memory profiler showing what
I mean
Any help would be very much appreciated
Thanks
Simon
class Program {
static void Main(string[] args) {
for (int i = 0; i < 1000; i++) {
PerformOperation();
}
}
private static void PerformOperation() {
GPSPositionTableAdapter da = new GPSPositionTableAdapter();
GPSPositionTable tblGPSPositions = new GPSPositionTable();
GPSPositionRow currentRow = null;
for (int i = 0; i < 50; i++) {
currentRow = tblGPSPositions.NewGPSPositionRow();
currentRow.DownloadID = 1;
currentRow.TTUReference = 9999;
currentRow.Timestamp = DateTime.Now;
currentRow.Latitude = 66.66666666666;
currentRow.Longitude = 66.66666666666;
tblGPSPositions.AddGPSPositionRow(currentRow);
}
da.Update(tblGPSPositions);
}
}
I have a huge memory leak problem in what is really very simple data
insert code.
In my app I'm trying to use a typed dataset to insert into a database.
It adds quite a few rows (say hundreds). Unfortunately it has a big ass
memory leak and I dont understand why.
The code below demonstrates the memory leak. It's like nothing is
cleaned up after PerformOperation is called.
According to .net memory profiler, after running the console app, there
are huge numbers of undisposed objects and meory usage is through the roof.
I've tried to attach a screenshot from .net memory profiler showing what
I mean
Any help would be very much appreciated
Thanks
Simon
class Program {
static void Main(string[] args) {
for (int i = 0; i < 1000; i++) {
PerformOperation();
}
}
private static void PerformOperation() {
GPSPositionTableAdapter da = new GPSPositionTableAdapter();
GPSPositionTable tblGPSPositions = new GPSPositionTable();
GPSPositionRow currentRow = null;
for (int i = 0; i < 50; i++) {
currentRow = tblGPSPositions.NewGPSPositionRow();
currentRow.DownloadID = 1;
currentRow.TTUReference = 9999;
currentRow.Timestamp = DateTime.Now;
currentRow.Latitude = 66.66666666666;
currentRow.Longitude = 66.66666666666;
tblGPSPositions.AddGPSPositionRow(currentRow);
}
da.Update(tblGPSPositions);
}
}