Proper user of DataSet

F

Frank Rizzo

Hello,

My app reads a large number of records (about 50MB, according to Task
Manager) into a Dataset. What is the proper clean up method when I am
done with the dataset?

There is oDS.Dispose(), oDS.Clear(), oDS = null?
Which should I use? It seems that if I use oDS.Clear(), the memory
usage (at least in the Task Manager) spikes up by 15 MB. Unless I am
missing something.

Thanks.
 
G

Guest

The best thing to do when your done with a DataSet that big set it to null as
soon as your done with it and make sure no other objects have a reference to
it. You can clear and dispose too if you want, but you want to release all
references to it as fast as possible in your code so if a GC happens, it can
clean up the DataSet.
 
C

Chad Z. Hower aka Kudzu

=?Utf-8?B?am9obiBjb253ZWxs?= said:
The best thing to do when your done with a DataSet that big set it to
null as soon as your done with it and make sure no other objects have
a reference to it. You can clear and dispose too if you want, but you
want to release all references to it as fast as possible in your code
so if a GC happens, it can clean up the DataSet.

You should call dispose first. Dispose will provide a possibility to clean up and release
resources earlier.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top