473,725 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 MashalByValueCo mponent.

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 5684
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 MashalByValueCo mponent.

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
MashalByValueCo mponent. 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
1847
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 changes(agencyData.Haschanges() = False)???? The bizaar thing is the row count before the delete and after is different so it definately is being deleted but I cannot update my main database table because the dataset thinks there are no changes?
35
2130
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; namespace TestNamespace {
0
1429
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
15
2248
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
1101
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 record based on the database that the record came from? Here is how I pulling data into my DataSet right now. Thanks,
2
1247
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, initiates an export process. When the button click event opens, the dataset is "Nothing". The dataset is Dim'ed to be available throughout the form. Other variables dim'ed at that same point are fine and can be used within the button click...
0
3890
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 device. I have a method to perform this task but it doesn't load the data into the SqlCe database. The data is downloaded into the dataset from the web service just fine but I can't get the data into the SqlCe database. Any suggestions would be...
10
4015
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
1654
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 through and inserting one row at a time is very expensive. Does anyone know a fast way with low overhead to accomplish this task. I have been working in this direction (code below) however the code inserts 0 rows into the access database. ...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.