[Mono-devel-list] [Patch] the bug 61671 - OdbcExecuteNonQuery bug
T Sureshkumar
tsureshkumar at novell.com
Tue Jul 27 07:25:50 EDT 2004
I have done a patch to bugzilla id 61671 (see description below). The
attached file 61671.patch is the patch file & the memtest.cs is the test
program. To check the mem leak, run the memtest.exe after compiling &
run "top" in another window. Make sure no other program is leaking
significantly.
My patch also has one more change which eliminates of a redundant
function GetSQLState which I added during my previous patches.
please suggest if any changes need to be done.
regards,
suresh.
=============================
Description of Problem:
OdbcCommand.ExecuteNonQuery is leaking.
I executed a simple program that inserts rows in a table (one-by-one)
using OdbcCommand.ExecuteNonQuery and I had the following error after a
few minutes:
GLib-ERROR **: gmem.c:140: failed to allocate 8192 bytes
aborting...
Using "top", I saw that "mono" had allocated 1Gb of memory...
Steps to reproduce the problem:
1. Execute the following program while monitoring memory usage of
"mono"
with "top":
using System;
using System.Data;
using System.Data.Odbc;
namespace MonoSQLLeakTest
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
using(IDbConnection dbConnection = new
OdbcConnection())
{
dbConnection.ConnectionString =
"DSN=<ADD
DSN NAME HERE>;UID=<ADD USER NAME HERE>;PWD=<ADD PASSWORD HERE>";
dbConnection.Open();
while(true)
{
MyMethod(dbConnection);
System.Console.Write(".");
}
}
}
static void MyMethod(IDbConnection dbConnection)
{
try
{
IDbCommand dbCommand =
dbConnection.CreateCommand();
dbCommand.CommandText = "Set rowcount
0";
dbCommand.ExecuteNonQuery();
}
catch(Exception exception)
{
System.Console.WriteLine
(exception.ToString());
}
}
}
}
Actual Results:
Crash of mono.
Expected Results:
Infinite loop.
How often does this happen?
Always
Additional Information:
Sybase Database
unixODBC
FreeTDS
mono-1.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 61671.patch
Type: application/octet-stream
Size: 6246 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040727/8e938f32/attachment.obj
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: memtest.cs
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040727/8e938f32/attachment.pl
More information about the Mono-devel-list
mailing list