Link to home
Start Free TrialLog in
Avatar of phunv
phunv

asked on

Free up memory used by a dataset

The code:
DataSet ds = new DataSet();
OleDbAdapter da = new OleDbAdapter(sqltext, connection);
da.Fil(ds, "foo");
the command text is a select command retrieving lots of data. After that call the memory jumps up (by more than 100M).
Then I try to clean up the dataset by:
ds.Tables["foo"].Clear();
ds.Dispose();
ds = null;
But the memory decreases by only a fraction of the above (about 10-20M).
What's wrong with the code, how can I free up the memory used by the dataset.
Thannks.
ASKER CERTIFIED SOLUTION
Avatar of s_sansanwal
s_sansanwal

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of s_sansanwal
s_sansanwal

DataSet ds = new DataSet();
OleDbAdapter da = new OleDbAdapter(sqltext, connection);
da.Fil(ds, "foo");
the command text is a select command retrieving lots of data. After that call the memory jumps up (by more than 100M).
Then I try to clean up the dataset by:
ds.Tables["foo"].Clear();
ds.Dispose();
ds = null;
GC.Collect();

Good Luck,
VINHNL