Dataset taking A LOT of memory (Update)

Dataset taking A LOT of memory (Update)

Post by Danny Libert » Wed, 24 Jul 2002 09:08:11

I forgot to mention that adding to the dataset also took much more time then
adding to the array...

Dataset taking A LOT of memory (Update)

Post by Ben Kloosterma » Wed, 24 Jul 2002 10:02:11

No ,

    Datasets use a lot of memory and are designed for functionality and
reuse of database datatypes -not simple byte structures. If you create data
and throw it away you should not use a Dataset - use a DataReader to a
collection of objects.
    Also try not to add lots of single items to a dataset row by row. Add
all the rows at once. DataTable.Merge([]DataRow) etc ;

    The internal represention can result in a lot of extra memory.Dont be
fooled by row collection (Rows) into thinking a Dataset is a simple Array
they do a much more complex function. If you are just storing bytes think
about the internal objects that need to be build  eg DataSet , Rows
collection , DataTables , DataRows , Collums  , DataView(default views) Item
Array , XMLBoundElement and many more etc . All these objects take a lot of
memory but make working with Datasets easy. You will also find that if you
use a more realistic representation eg 50 Unicode character first name ,
last name ,  address then the over head is not as high.


Anyway the internal representation is quite complex.


Quote:> I forgot to mention that adding to the dataset also took much more time
> adding to the array...


1. Dataset taking A LOT of memory


I'm using a dataset to store some byte values. I've created a dataset with
10 columns, each one representing a byte.
I then added a few thousand rows to the dataset using a for loop.
To compare, I did the same thing, but this time using a 2 dimensional byte
To my surprise, the dataset took more than 5 times memory than the array !
(I'm talking about megabytes !!).
Why does the dataset take up so much memory ? Is there any way to tweak the
dataset so it will take less ?

I'd be glad if someone could supply the answers to these questions.



2. Problem maintaining ADSL connection

3. IDE eats up a lot of memory during help

4. Ram disk --> Slot 7?

5. Bug with Updating in memory dataset ?

6. Freenet-setup help needed

7. msdev.exe taking more and more memory

8. Verilog/VHDL Question

9. aspnet_wp.exe taking too much memory

10. aspnet_wp process taking up *huge* amounts of memory

11. Dataset update - cannot update a dataset

12. Best way to update a lot of rows using ADO.NET

13. Datasets and memory usage (was: Marshaling datasets & poor performance)