G
Guest
Hi,
How do I free up the memory taken up by the .NET datatable and dataset after
I finished working with them? How do I HELP the GC to do its job sooner to
release memory taken up by DataTable/DataSet?
I am worried about memory usage. Should I be using DataReader exclusively?
But complex databinding is going to cause problem to me because it is going
to keep the connection open for longer than necessary.
Would it help if I create an arraylist of DbDataRecord from DataReader
instead?
If reader.HasRows Then
For Each rec As System.Data.Common.DbDataRecord In reader
arr.Add(rec)
Next
End If
I am guessing that arraylist takes up less memory than a DataTable. Am I
correct? Or is there a way for me to check how much memory each takes up
(datatable v.s. Arraylist of DbDataRecord)?
Then, how do I use this technique to construct more than one arraylist when
the datareader returns more than one result set? I can only get the first
resultset and i don't know why. It seems that the reader is closed
automatically when I use this technique.
Another question I have is about DataTable's DataTableReader. What's the
point to use a DataTableReader? Does it make databinding faster than binding
to Datatable itself? I am sure this would not take less memory so why?
Thanks for any advice you can provide!
How do I free up the memory taken up by the .NET datatable and dataset after
I finished working with them? How do I HELP the GC to do its job sooner to
release memory taken up by DataTable/DataSet?
I am worried about memory usage. Should I be using DataReader exclusively?
But complex databinding is going to cause problem to me because it is going
to keep the connection open for longer than necessary.
Would it help if I create an arraylist of DbDataRecord from DataReader
instead?
If reader.HasRows Then
For Each rec As System.Data.Common.DbDataRecord In reader
arr.Add(rec)
Next
End If
I am guessing that arraylist takes up less memory than a DataTable. Am I
correct? Or is there a way for me to check how much memory each takes up
(datatable v.s. Arraylist of DbDataRecord)?
Then, how do I use this technique to construct more than one arraylist when
the datareader returns more than one result set? I can only get the first
resultset and i don't know why. It seems that the reader is closed
automatically when I use this technique.
Another question I have is about DataTable's DataTableReader. What's the
point to use a DataTableReader? Does it make databinding faster than binding
to Datatable itself? I am sure this would not take less memory so why?
Thanks for any advice you can provide!