472,353 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

DataSet object not releasing memory

Hi,

I'm encountering a strange phenomenon whereby a DataSet object is not
releasing its memory when it's being disposed and/or set to Nothing.

It is part of a Windows service written in VB.NET which fetches data out of
a mySQL database, interrogates each row individually and takes various
actions accordingly. It can fetch upwards of 300,000 rows, each of which
vary between 1k and 2k in size, making the resulting DataSet object almost
500Mb in size. This in itself is not much of a problem, except that when the
service has finished working with the DataSet, it does not release the
memory it has been using.

I'm using it in what appears to me at least to be a fairly standard way
(code at the end of this post).

What do I have to do to free up the memory allocated to the DataSet object?
I've even tried running System.GC.Collect(), though that expectedly made no
difference.

Any assistance gratefully received.

Mark Rae
Option Explicit On
Option Strict On

Imports CoreLab.MySql
Imports System.Collections
Imports System.Data
Imports System.Xml

Public Function Import(pstrMySQLConnectString As String, pstrSQL As String)
As Boolean

Dim objMySQL As New CMySQLCoreLab(pstrMySQLConnectString)
Dim objMySQLDS As DataSet

objMySQLDS = objMySQL.GetDataSet(pstrSQL)

For Each objRow As DataRow in objMySQLDS.Tables(0).Rows
'
' do the processing
'
Next

objMySQLDS.Dispose
objMySQLDS = Nothing
objMySQL.Dispose
objMySQL = Nothing

End Function
Nov 21 '05 #1
5 9102
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in
news:uj**************@tk2msftngp13.phx.gbl:
I'm encountering a strange phenomenon whereby a DataSet object is not
releasing its memory when it's being disposed and/or set to Nothing.


How are you measuring this fact? Dispose does not actually free the memory,
thats up to the GC.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 21 '05 #2
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
How are you measuring this fact?
By looking at Task Manager.
Dispose does not actually free the memory,


According to the MSDN docs, the Dispose method "releases all resources used
by the System.ComponentModel.Component" - are you saying that doesn't
include the memory that the component has been allocated?
Nov 21 '05 #3
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in
news:ev**************@TK2MSFTNGP12.phx.gbl:
How are you measuring this fact?


By looking at Task Manager.


Never use TM for memory measurement, ESPECIALLY with .NET applications.
Dispose does not actually free the memory,


According to the MSDN docs, the Dispose method "releases all resources
used by the System.ComponentModel.Component" - are you saying that
doesn't include the memory that the component has been allocated?


Correct. You should read up on the GC in .NET. In .NET release <> Free up
memory.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 21 '05 #4
Mark,

There should not be any reason to dispose a dataset, it cost only (very few)
time.

When you want to clear it, have a look at
dataset.clear or dataset.reset

Forcing the Garbage Collector will cost time at moments that it is
inefficient.

I hope this helps?

Cor
Nov 21 '05 #5
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP15.phx.gbl...

Cor,

Thanks for the reply - some practical advice!
There should not be any reason to dispose a dataset, it cost only (very
few) time.

When you want to clear it, have a look at
dataset.clear or dataset.reset
OK - I'll certainly have a look at that.
Forcing the Garbage Collector will cost time at moments that it is
inefficient.


Yes - I don't like to force a System.GC.Collect()...

Mark
Nov 21 '05 #6

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

Similar topics

3
by: music4 | last post by:
Greeting, My platform is Solaris 2.8. My question is that if there is a simple way to put a class object in share memory, so that multiple...
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...
3
by: greg.merideth | last post by:
There's a utility application I have that generates Excel files for the end users that 99% of the time works just fine. The problem I've...
5
by: david.kao | last post by:
Hi All: I am creating a COM+ Pool object in C#. I set up the following attributes: JIT (true),Pool size; and at the end of each public method I...
2
by: Lawrence Chang | last post by:
Hi My friends, Can I save dataset object to an application variable? I want all the customer use this dataset. and diffrent customer create...
3
by: GBR | last post by:
I have a collection object inherited from collection base that is used to carry my object entities from server to client through a web service. I...
6
by: Pablo | last post by:
Hello, I am writing a windows application using C++ and BorlandBuilder 6 compiler. It is an event driven program and I need to create objects of...
2
by: Ivor Somerset | last post by:
Hello, In my ASP code I sometimes write functions that return an object (generally an XML node). Such a function is invoked this way: Set...
7
by: Piotrekk | last post by:
Hi I am using INCA RTX library which i've added to my project resources. Then i created an object i need to release it manually. I have found...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.