L
Leo Tohill
Here's an interesting finding about when the memory of a datarow is freed.
if you do this:
DataRow newRow = dataTable.NewRow();
The new row will never be GC'd, even after newRow goes out of scope, and
even though the new row has state "Detached".
On the other hand, do this:
DataRow newRow = dataTable.NewRow();
newRow.Table.Rows.Add(newRow);
newRow.Delete(); // changes state to "detached"
This allows newRow to be GC'd. This looks like a gimmick to me - it should
not be necessary. But, it works.
Just FYI y'all.
- Leo Tohill
if you do this:
DataRow newRow = dataTable.NewRow();
The new row will never be GC'd, even after newRow goes out of scope, and
even though the new row has state "Detached".
On the other hand, do this:
DataRow newRow = dataTable.NewRow();
newRow.Table.Rows.Add(newRow);
newRow.Delete(); // changes state to "detached"
This allows newRow to be GC'd. This looks like a gimmick to me - it should
not be necessary. But, it works.
Just FYI y'all.
- Leo Tohill