K
Ken Varn
I have a managed C++ application that is exhibiting a memory leak. I
isolated the leak down to a section of code that basically uses a managed
ADO.NET SQLDataReader object. The leak seems to occur on the
ExecuteReader() call. I am calling this method over and over again at
fairly rapid intervals. The Close() method of the reader is always called
when I am done with the SQLDataReader. Can someone tell me if there is a
way around this leak or if there is a fix out there?
Sample Code:
SqlCommand *SQLCmd = __gc new SqlCommand();
SqlDataReader *SQLReader;
SQLCmd->Connection = MyConnectionObject;
SQLCmd->CommandText = "sp_SelectImageEventID @nImageType = 1"; // My
stored procedure
SQLReader = SQLCmd->ExecuteReader();
if (SQLReader->HasRows)
{
// Do stuff
}
SQLReader->Close();
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------
isolated the leak down to a section of code that basically uses a managed
ADO.NET SQLDataReader object. The leak seems to occur on the
ExecuteReader() call. I am calling this method over and over again at
fairly rapid intervals. The Close() method of the reader is always called
when I am done with the SQLDataReader. Can someone tell me if there is a
way around this leak or if there is a fix out there?
Sample Code:
SqlCommand *SQLCmd = __gc new SqlCommand();
SqlDataReader *SQLReader;
SQLCmd->Connection = MyConnectionObject;
SQLCmd->CommandText = "sp_SelectImageEventID @nImageType = 1"; // My
stored procedure
SQLReader = SQLCmd->ExecuteReader();
if (SQLReader->HasRows)
{
// Do stuff
}
SQLReader->Close();
--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.
EmailID = varnk
Domain = Diebold.com
-----------------------------------