tags:

views:

102

answers:

2

In our now-not-so-modern n-tier application we make intesive use of DataSets and we are evaluating the change to other lighter objects (i.e. collections of typified objects).

Is there any reference document about how much can we gain in memory consumption by doing that?

+1  A: 

This question is pretty subjective and depends on many factors that can't be shown here. If the question was will a DataSet consume more memory than a generic collection of the same number of objects then the answer is generally yes.

Since the question is how much it's going to depend on the specifics of how you are using the DataSet (ie: typed data, DataViews?, indexes?) and only accurately measured through testing.

However, depending on how you are using the DataSets you might have to rebuild much of that functionality.

Cory Charlton
+2  A: 

The heavy hitters on memory usage for a DataSet are the DataRow object required for each row in a DataTable and the index that's automatically generated for each column. Storage of the column values is efficient, you can't improve that. Replacing this with a collection of generic collections will allow elimination of the DataRows, that could be a rough 50% savings if the DataTable doesn't have a lot of columns.

The indexes is what you need to worry about. They make queries on the DataSet very fast, you'll lose that unless you provide some kind of custom substitute. Whether you'll need to provide a substitute is impossible to say, it depends on the kind of queries you run.

Hans Passant
Thanks for your tips. We are using DataSets mainly for editing, just as persistent objects, so we don't use indexing features that much. What we use the more is the RowVersion feature in order to know what was edited.
jmservera