Memory leaks with with massive queries
Posted: Wed 21 Jul 2010 14:08
Hi, I'm using Devart.Data.PostgreSql v4.95.146 (Express Edition) to stress a server with a simple query with random parameter's values.
The query is executed with a DbDataReader, obtaining nearly 1500 queries/second. But after 2 hours of running time, the memory's usage goes up from 45 MB to 1.5 GB, even at a visible pace with Process Explorer utility and its Performance Graph.
The simplified code looks like this:
For longer periods we got OutOfMemory exceptions with this callstack:
Any ideas?
Thanks for your support.
The query is executed with a DbDataReader, obtaining nearly 1500 queries/second. But after 2 hours of running time, the memory's usage goes up from 45 MB to 1.5 GB, even at a visible pace with Process Explorer utility and its Performance Graph.
The simplified code looks like this:
Code: Select all
var connectionString = "...";
using (var connection = new PgSqlConnection(connectionString) { Unicode = true })
{
var sql = "select field from table where f1=? and f2=?;"
using (var command = new PgSqlCommand(sql, connection);
{
command.Parameters.AddRange(GetParameters()); // DbParameter[] GetParameters () {...}
command.Prepare();
while (true)
{
SetParameterValues(command.Parameters); // void SetParameterValues (DbParameterCollection parameters) {...}
using (var reader = command.ExecuteReader(CommandBehavior.SingleResult))
{
var count = 0L;
while (reader.Read())
{
count++;
}
}
}
}
}
Code: Select all
System.OutOfMemoryException.
in Devart.Common.Utils.SetWeakTarget(WeakReference& weakReference, Object target)
in Devart.Common.DbReferenceCollection.AddItem(Object value, Int32 tag)
in Devart.Common.DbReferenceCollection.Add(Object value, Int32 tag)
in Devart.Common.DbConnectionInternal.a(Object A_0, Int32 A_1)
in Devart.Common.DbConnectionBase.a(DbDataReader A_0)
in Devart.Data.PostgreSql.PgSqlCommand.AddDataReader(DbDataReader reader)
in Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
in Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
in System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
in ...
Thanks for your support.