T
Tristan
Hi,
I have a DataTable object and need a subset of the rows at runtime so
I perform a DataTable.Select on it to retrieve an array of DataRows. I
am using this over the DataView/Filter approach as it performs
slighltly better in my application.
The problem is that the returned DataRow array does get removed from
memory. I have tried setting all the elements to null, setting the
array variable to null, wrapping the array variable in an IDisposable
class, calling GC.Collect etc. etc. but it still does not get removed
from memory.
Example code below:
DataRow[ ] dr = myDataTable.Select("ProductType = 'Book');
// Perform business logic based on contents of array
dr = null;
GC.Collect(); // Memory used up by dr variable not freed.
Any help appreciated.
Thanks
Tristan.
I have a DataTable object and need a subset of the rows at runtime so
I perform a DataTable.Select on it to retrieve an array of DataRows. I
am using this over the DataView/Filter approach as it performs
slighltly better in my application.
The problem is that the returned DataRow array does get removed from
memory. I have tried setting all the elements to null, setting the
array variable to null, wrapping the array variable in an IDisposable
class, calling GC.Collect etc. etc. but it still does not get removed
from memory.
Example code below:
DataRow[ ] dr = myDataTable.Select("ProductType = 'Book');
// Perform business logic based on contents of array
dr = null;
GC.Collect(); // Memory used up by dr variable not freed.
Any help appreciated.
Thanks
Tristan.