473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

DataSet and Dispose

Hi,

What are the performance benefits of calling Dispose on a DataSet?

We have a (web) application that we tried to run on a shared server.
It crashed due to memory constraints.
The helpdesk of the hoster said "you need to call Dispose on every
object". Now I know that not every object implements this method,
but DataSet does (and we use it a lot).

I understand that you need to call Dispose when you use unmanaged
resources (like handles to the filesystem or database), and we do.
However when I read the documentation for DataSet it seems to me
that Dispose only has effect for remote datasets. DataSet does not
implement Dispose itself, but inherits it from MashalByValueComponent.

It shouldn't hurt to call Dispose at the appropriate moment, but will
it help in keeping the memory-use down?

Hans Kesting
Nov 16 '05 #1
2 5665
Hans,

Calling dispose should do nothing, you better can check in my opinion if you
do not have some open reference somewhere to your dataset. That is easily
done in the situation of a dataset. And the dataset is only freeed by the GC
when there are no references anymore to it. Setting itself to nothing helps
not much.

Cor

"Hans Kesting" <ne***********@spamgourmet.com>
l...
Hi,

What are the performance benefits of calling Dispose on a DataSet?

We have a (web) application that we tried to run on a shared server.
It crashed due to memory constraints.
The helpdesk of the hoster said "you need to call Dispose on every
object". Now I know that not every object implements this method,
but DataSet does (and we use it a lot).

I understand that you need to call Dispose when you use unmanaged
resources (like handles to the filesystem or database), and we do.
However when I read the documentation for DataSet it seems to me
that Dispose only has effect for remote datasets. DataSet does not
implement Dispose itself, but inherits it from MashalByValueComponent.

It shouldn't hurt to call Dispose at the appropriate moment, but will
it help in keeping the memory-use down?

Hans Kesting

Nov 16 '05 #2
Cor Ligthert wrote:
Hans,

Calling dispose should do nothing,
I thought so.
you better can check in my opinion
if you do not have some open reference somewhere to your dataset.
That is easily done in the situation of a dataset.
If we have done our job right, this shouldn't happen (in case of a
WEB application, this should only happen when you store it in Session
or Cache or something like that)
And the dataset is
only freeed by the GC when there are no references anymore to it.
Setting itself to nothing helps not much.
I know.


Cor

Thanks.
Hans Kesting

"Hans Kesting" <ne***********@spamgourmet.com>
l...
Hi,

What are the performance benefits of calling Dispose on a DataSet?

We have a (web) application that we tried to run on a shared server.
It crashed due to memory constraints.
The helpdesk of the hoster said "you need to call Dispose on every
object". Now I know that not every object implements this method,
but DataSet does (and we use it a lot).

I understand that you need to call Dispose when you use unmanaged
resources (like handles to the filesystem or database), and we do.
However when I read the documentation for DataSet it seems to me
that Dispose only has effect for remote datasets. DataSet does not
implement Dispose itself, but inherits it from
MashalByValueComponent. It shouldn't hurt to call Dispose at the appropriate moment, but will
it help in keeping the memory-use down?

Hans Kesting

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Grant | last post by:
Hello, How come when I add a new row to my dataset table it shows up as changed (agencyData.Haschanges() = True) but when I delete a row the dataset thinks here are no...
35
by: MuZZy | last post by:
Hi All, I got a issue here and hope someone can help me: Let's consider this code: // =================== CODE START ================================= using System; using System.Data; ...
0
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
15
by: JIM.H. | last post by:
Hello, Can I send a dataset as a parameter into stored procedure and import data to a table in the stored procedure? Thanks, Jim.
0
by: crjunk | last post by:
Hi, I'm pulling data from 3 different databases into 1 DataSet. Is there a way that I can insert a new field into the DataSet and add a value (such as "MSBA", "AFCA", "AFNAT", etc...) to each...
2
by: Wayne Wengert | last post by:
I have a VB App (VSNET 2003) in which, during form load, I create a dataset (ds1) and then populate a datagrid by binding to the dataset. That works fine. The form has a button which, when clicked,...
0
by: Johnny | last post by:
I have a PocketPC mobile application that gets its data from the Sql Server database via a web service. The web service returns a dataset that I need to load into the SqlCe database on the mobile...
10
by: Agnes | last post by:
Does dataset dispose will lead the related dataadpator , or database will dispose also ? Or I need to dispose them one by one ??
0
by: SL Culby | last post by:
Hello everyone, I have a project where I pull SQL Server data put it into a dataset and now I have to put the dataset data into an Access Database. The dataset currently is over 2000 row, so looping...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.