M
Matt Weber
I've been trying to track down a memory leak in a project and have been
running around in circles for the past week or so. I've been using this
as an opportunity to evaluate Compuware's devPartner, but unfortunately
it seems to be doing more to confuse me than to help me. My problem can
be illustrated by the block of code attached to KB article 318263
(http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q318263). The
article gives this code as an example of a perceived, but not real,
memory leak. However, I think there is a real memory leak within the
SqlDataAdapter, unrelated to the perceived leaking that the article
talks about.
DataSet ds;
SqlConnection cn =
new SqlConnection("data source=localhost;initial
catalog=Northwind;user id=USER;password=PASSWORD");
cn.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from Employees", cn);
ds = new DataSet();
for (int i = 0; i < 1000; i++)
{
da.Fill(ds, "Table" + i.ToString());
}
cn.Close();
The leak is not major -- devPartner only reports ~50k being leaked, and
the entirety of it is reported as leaked by the da.Fill(...) method
call. But, 50k in this snippet could (and seems to have been within my
project) be amplified when adding larger tables to a DataSet. Has
anyone looked into this before? Is this a real issue with the
SqlDataAdapter, or am I hunting a snipe?
Thanks for reading,
-Matt
running around in circles for the past week or so. I've been using this
as an opportunity to evaluate Compuware's devPartner, but unfortunately
it seems to be doing more to confuse me than to help me. My problem can
be illustrated by the block of code attached to KB article 318263
(http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q318263). The
article gives this code as an example of a perceived, but not real,
memory leak. However, I think there is a real memory leak within the
SqlDataAdapter, unrelated to the perceived leaking that the article
talks about.
DataSet ds;
SqlConnection cn =
new SqlConnection("data source=localhost;initial
catalog=Northwind;user id=USER;password=PASSWORD");
cn.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from Employees", cn);
ds = new DataSet();
for (int i = 0; i < 1000; i++)
{
da.Fill(ds, "Table" + i.ToString());
}
cn.Close();
The leak is not major -- devPartner only reports ~50k being leaked, and
the entirety of it is reported as leaked by the da.Fill(...) method
call. But, 50k in this snippet could (and seems to have been within my
project) be amplified when adding larger tables to a DataSet. Has
anyone looked into this before? Is this a real issue with the
SqlDataAdapter, or am I hunting a snipe?
Thanks for reading,
-Matt