( This issue was reported in the .NET Provider Devel list, this is the same text as the original message in the mail list )
We're moving away from Access and try using Firebird in its standalone
version (not the server), with http://ADO.Net. After migrating our application, we
noticed significant memory leaks (around 500 MB during the night). Following
Mr Makowsky's recommendation, we tried to trigger the Windows Garbage
Collector but to no effect.
Here's a sample code, just to illustrate the problem. The first example uses
the Firebird Data Reader, in C#. The memory leak is of 100 MB/hour. The
second example uses an Adapter, which reduces the memory leak to around
30MB/hour.
Is the problem in the .Net layer ? Shall we use the C++ API instead or are
we doing something wrong ? Any recommendation on what to do for avoiding
those memory leaks would be welcome !
FbCommand fbc = m_con.CreateCommand();
FbDataReader m_FbReader;
DataSet ds;
fbc.CommandType = CommandType.Text;
fbc.CommandText = "SELECT * FROM T_Domino_IndexedScanData ";
Submitted by: @carlosga
Assigned to: @carlosga
( This issue was reported in the .NET Provider Devel list, this is the same text as the original message in the mail list )
We're moving away from Access and try using Firebird in its standalone version (not the server), with http://ADO.Net. After migrating our application, we noticed significant memory leaks (around 500 MB during the night). Following Mr Makowsky's recommendation, we tried to trigger the Windows Garbage Collector but to no effect.
Here's a sample code, just to illustrate the problem. The first example uses the Firebird Data Reader, in C#. The memory leak is of 100 MB/hour. The second example uses an Adapter, which reduces the memory leak to around 30MB/hour.
Is the problem in the .Net layer ? Shall we use the C++ API instead or are we doing something wrong ? Any recommendation on what to do for avoiding those memory leaks would be welcome !
FbCommand fbc = m_con.CreateCommand();
FbDataReader m_FbReader;
DataSet ds;
fbc.CommandType = CommandType.Text;
fbc.CommandText = "SELECT * FROM T_Domino_IndexedScanData ";
for(int i =0 ;i<100000;i++){
m_FbReader = fbc.ExecuteReader();
ds = new DataSet("Monitor");
String sTable = "T_Domino_IndexedScanData";
DataTable dtable = new DataTable(sTable);
ds.Tables.Add(dtable);
ds.Load(m_FbReader, LoadOption.OverwriteChanges, dtable);
//On dispose le Data Set
foreach(DataTable dt in ds.Tables){
foreach(DataColumn dc in dt.Columns){
dc.Dispose();
}
dt.Clear();
dt.Dispose();
}
ds.Clear();
ds.Dispose();
m_FbReader.Close();
dtable.Clear();
dtable.Dispose();
}
fbc.Dispose();
Second example with an Adapter
FbCommand fbc = m_con.CreateCommand();
fbc.CommandType = CommandType.Text;
fbc.CommandText = "SELECT * FROM T_Domino_IndexedScanData ";
FbDataAdapter fbda = new FbDataAdapter(fbc);
for (int i = 0; i < 100000; i++)
{
DataSet ds = new DataSet("Monitor");
fbda.Fill(ds);
//On dispose le Data Set
foreach (DataTable dt in ds.Tables)
{
foreach (DataColumn dc in dt.Columns)
{
dc.Dispose();
}
dt.Clear();
dt.Dispose();
}
ds.Clear();
ds.Dispose();
}
fbda.Dispose();
fbc.Dispose();