InsertAllOnSubmit Memory Leak Exception

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
idem84
Posts: 51
Joined: Thu 04 Apr 2013 19:12

InsertAllOnSubmit Memory Leak Exception

Post by idem84 » Fri 10 May 2013 17:31

Im trying to backup large amount of data, but OutOfMemoryException throws, in task manager reach from 20mb, then 30mb, 40mb.. to ~1.5gb used.
GetChangeSet() is reset correctly at each iteration
I set EntityCachingMode.WeakReference, but no success
And i notice that the memory usage keeps increasing while looping. I even force garbage collection also cannot reclaim any of the memory.
Im using dotConnect for MySQL 7.6.226 (LinqConnect), VS2012.2, Win8x64
Is there anything wrong with my interact with LINQ so that causes the memory hold up and not being released.
Sorry my english is not so good
Thanks in advance!


var oldestDayToBackup = GetOldestDayToBackup();
while (oldestDayToBackup != null)
{
var day = (DateTime)oldestDayToBackup;
var dayRowCount = GetOldestDayToBackupRowCount(day);
while (dayRowCount > 0)
{
var pendingRows = GetOldestDayRowsToBackup(day);

try
{
MBackupGpsDataContext.Gpshistoricbackups.InsertAllOnSubmit(pendingRows);
MBackupGpsDataContext.SubmitChanges();
GC.Collect()
}
catch (Exception ex)
{
}
dayRowCount = GetOldestDayToBackupRowCount(day);
}
oldestDayToBackup = GetOldestDayToBackup();
}

idem84
Posts: 51
Joined: Thu 04 Apr 2013 19:12

Re: InsertAllOnSubmit Memory Leak Exception

Post by idem84 » Fri 10 May 2013 20:33

The same occurs if i use a new context instance. After minutes... throws OutMemoryExcpetion because holds the memory i check task manger too
Is there anything wrong with my interact with LINQ so that causes the memory hold up and not being released.

private void TryBackup(DateTime day)
{
var innerMBackupGpsDataContext = new MultiGpsBackupDataContext { EntityCachingMode = EntityCachingMode.WeakReference };

var pendingRows = GetOldestDayRowsToBackup(day);
var backupRows = pendingRows.Select(x => GetGpsHistoricBackup(x));
try
{
innerMBackupGpsDataContext.Gpshistoricbackups.InsertAllOnSubmit(backupRows);
innerMBackupGpsDataContext.SubmitChanges();
innerMBackupGpsDataContext.Dispose();
GC.Collect();
}
catch (Exception ex)
{

}
}

idem84
Posts: 51
Joined: Thu 04 Apr 2013 19:12

Re: InsertAllOnSubmit Memory Leak Exception

Post by idem84 » Fri 10 May 2013 22:39

Testing i noticed that:
The issue only happens using Windows Forms
In console app no memory leak

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: InsertAllOnSubmit Memory Leak Exception

Post by MariiaI » Mon 13 May 2013 10:03

Could you please provide us with a small test project, so that we are able to investigate this issue in more details.

idem84
Posts: 51
Joined: Thu 04 Apr 2013 19:12

Re: InsertAllOnSubmit Memory Leak Exception

Post by idem84 » Mon 13 May 2013 18:58

I found the cause, it is an incompatibility with other components, only happens when I use a form DevComponents.DotNetBar.Metro.MetroForm type. I can send the sample project, but you need to have these components installed. I am very interested in that could work together.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: InsertAllOnSubmit Memory Leak Exception

Post by MariiaI » Tue 14 May 2013 09:17

Yes, most likely this error is related to DevComponents.DotNetBar.Metro.MetroForm component, not LinqConnect.
However, please send us the sample project and specify the stack trace of the exception you are getting.
We will investigate it and inform you about the results as soon as any are available.

idem84
Posts: 51
Joined: Thu 04 Apr 2013 19:12

Re: InsertAllOnSubmit Memory Leak Exception

Post by idem84 » Mon 20 May 2013 15:13

I sent it
Thanks

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: InsertAllOnSubmit Memory Leak Exception

Post by MariiaI » Wed 22 May 2013 09:38

Thank you for the sample project. We couldn't reproduce the OutOfMemoryException with your sample project, LinqConnect 4.2.247 and DotNetBar for Windows Forms Trial 11.2 (DevComponents.DotNetBar.Metro.MetroForm).
Please specify the stack trace of the exception.

Post Reply