May be connection Pool problem?
Posted: Wed 19 May 2010 16:39
I have a code like following:
TransactionOptions topt = new TransactionOptions();
topt.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
topt.Timeout = new TimeSpan(0, 0, 60);
for(int i = 0; i < 10000; i++)
{
using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, topt))
{
using (ObjectContext db = new ObjectContext (_ConnectionString))
{
var query = from tb in tablename
select ...
EntityName entity = query.FirstOrDefault();
}
ts.Complete()
}
}
_ConnectionString is using OCI client mode (Direct=false), I found it will cause memory leak when I run this code second, third times after previous run immediately. Memory will not be released, even though waited it for a long time .
If TransactionScopeOption.Suppress, there was no memory leak problem.
If I adjust transactionscope timespan to 3~5 seconds, memory leak will not be obvious.
If I add 'Pool=false' into connection string. There was no memory leak problem.
Finally, I add 'Connection Lifetime=600' into my connection string. Memory was be returned every 600 seconds.
My oracle client: 10.2.0 or 11.1.0
Devart: 5.60.124
OS: Windows Server 2003 sp2
Visual Studio 2008 sp1
TransactionOptions topt = new TransactionOptions();
topt.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
topt.Timeout = new TimeSpan(0, 0, 60);
for(int i = 0; i < 10000; i++)
{
using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, topt))
{
using (ObjectContext db = new ObjectContext (_ConnectionString))
{
var query = from tb in tablename
select ...
EntityName entity = query.FirstOrDefault();
}
ts.Complete()
}
}
_ConnectionString is using OCI client mode (Direct=false), I found it will cause memory leak when I run this code second, third times after previous run immediately. Memory will not be released, even though waited it for a long time .
If TransactionScopeOption.Suppress, there was no memory leak problem.
If I adjust transactionscope timespan to 3~5 seconds, memory leak will not be obvious.
If I add 'Pool=false' into connection string. There was no memory leak problem.
Finally, I add 'Connection Lifetime=600' into my connection string. Memory was be returned every 600 seconds.
My oracle client: 10.2.0 or 11.1.0
Devart: 5.60.124
OS: Windows Server 2003 sp2
Visual Studio 2008 sp1