473,378 Members | 1,531 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,378 software developers and data experts.

Best way to release Memory used by Datasets

Hi,

We are using vb.net in our "windows application" and are using datasets
heavily (100s of them). We declare them in our methods and use them and
currently are not doing anything to specifically dispose or reclaim memory.

What is the best way to dispose them and reclaim memory. We are fine even if
the GC collects them properly after a certain time. We just do not want the
datasets to be sitting in Memory after their usage is complete.

Does the VB GC take care of this automatically ? or should we do something
specific like assigning DS = Nothing or using DS.dispose() etc.

Thanks a lot for your responses.

S Anand

--
- Anand
Nov 21 '05 #1
4 3036
S Anand,

If you use Net or any other modern way that uses a GC, than you should allow
that memory is released in a time that it is the best for the performance.

What is the reason that you want to free memory that you don't need?

In my opinion is the way you do it now, just fine.
Assuming the code is completly inside the method this
\\\
Dim ds as new dataset
////

I hope this helps,

Cor
Nov 21 '05 #2
> S Anand,

If you use Net or any other modern way that uses a GC, than you should allow
that memory is released in a time that it is the best for the performance.

What is the reason that you want to free memory that you don't need?
> Reason being to ensure that our application runs at optimal speed. If something is not needed , I want to ensure that it will be collected at the next GC cycle.
> Also, I read that DAtaset is an Unmanaged object (along with db connections and some others) . So need to know whether we need to code something specific

In my opinion is the way you do it now, just fine.
Assuming the code is completly inside the method this
\\\
Dim ds as new dataset
//// Some of our datasets are created and passed around to multiple methods as parameters. Some are declared in the Windows Form declaration section and used all over the form.

So, I want to ensure that after we close the form, these are marked for
release properly and so want to know if there is any specific way to do this.
Nov 21 '05 #3
S Anand,
>> Also, I read that DAtaset is an Unmanaged object (along with db
>> connections and some others) .

Can you show us where?

As you create your dataset global, and you are sure not reusing (and than
the old one looses his reference so it goes automaticly to nothing) than you
can set it to nothing to tell the GC when it starts that it has no
references anymore. (In my opinion has this only sense with real huge
datasets)

I hope this helps,

Cor
Nov 21 '05 #4
in my opinion the easiest way is to write all your data handling in methods
( all objects declared in a method ) this way it will be market for
collecting when the method has finished ( fastest \ easiest way ) without you
having to wite extra code for it

regards

M.Posseth

"Cor Ligthert [MVP]" wrote:
S Anand,
>>> Also, I read that DAtaset is an Unmanaged object (along with db
>>> connections and some others) .

Can you show us where?

As you create your dataset global, and you are sure not reusing (and than
the old one looses his reference so it goes automaticly to nothing) than you
can set it to nothing to tell the GC when it starts that it has no
references anymore. (In my opinion has this only sense with real huge
datasets)

I hope this helps,

Cor

Nov 21 '05 #5

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

Similar topics

4
by: Chuck Ritzke | last post by:
I keep asking myself this question as I write class modules. What's the best/smartest/most efficient way to send a large object back and forth to a class module? For example, say I have a data...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
7
by: Erkan Tatlidil | last post by:
Hi, Our customer has a win2k Xeon 2.0 web server with 2GB of Ram. After a certain time the aspnet_wp.exe consumes %70 of the Ram and comes to a standstill. We end the process and everything is...
7
by: Ben Kim | last post by:
Hello all, I am coming from another development environment (Clarion for Windows) and they offer a special In-Memory driver which acts just like a database driver. What would be the appropriate...
3
by: cbrown | last post by:
I am rebuilding an existing application that relies on an SQL DB. The app is a scheduling/employee management program. My question pertains to best practices in dotnet and database. I use a 3...
0
by: xievvv | last post by:
We are experiencing a memory leak in one of our applications. It is a web-based reporting system that produces large (> 500mb) PDF reports. It takes approx 4 hours to run the largest of these reports...
3
by: =?Utf-8?B?SlA=?= | last post by:
I have a web application that will handle anywhere for 50 to 175 users at one time but will likely have a user base in the 100s. This application contains a GUI interface for the every day user and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.