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.Colle ct(), though that expectedly made no
difference.
Any assistance gratefully received.
Mark Rae
Option Explicit On
Option Strict On
Imports CoreLab.MySql
Imports System.Collecti ons
Imports System.Data
Imports System.Xml
Public Function Import(pstrMySQ LConnectString As String, pstrSQL As String)
As Boolean
Dim objMySQL As New CMySQLCoreLab(p strMySQLConnect String)
Dim objMySQLDS As DataSet
objMySQLDS = objMySQL.GetDat aSet(pstrSQL)
For Each objRow As DataRow in objMySQLDS.Tabl es(0).Rows
'
' do the processing
'
Next
objMySQLDS.Disp ose
objMySQLDS = Nothing
objMySQL.Dispos e
objMySQL = Nothing
End Function 5 9193
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in
news:uj******** ******@tk2msftn gp13.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/
"Programmin g is an art form that fights back"
Develop ASP.NET applications easier and in less time: http://www.atozed.com/IntraWeb/
"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.Componen tModel.Componen t" - are you saying that doesn't
include the memory that the component has been allocated?
"Mark Rae" <ma**@mark-N-O-S-P-A-M-rae.co.uk> wrote in
news:ev******** ******@TK2MSFTN GP12.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.Componen tModel.Componen t" - 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/
"Programmin g is an art form that fights back"
Empower ASP.NET with IntraWeb http://www.atozed.com/IntraWeb/
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
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:%2******** *******@TK2MSFT NGP15.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.Colle ct()...
Mark This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 process can use this
object.
Thanks in advance!
Evan
|
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
{
|
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 encountered is when placing a lot of data (and by a
lot I mean creating 90+ tabs and filling each worksheet with 4-5,000
values with misc formatting per sheet) an exception is thrown when I
attempt to release the worksheet using:
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlInvSheet);
|
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 called
ContextUtil.DeactivateOnReturn=true to set DONE flag; and also I override
CanBeBooled method to true.
In my calling program in C#, first of all I am using NEW to create a object,
then I call the method then I call dispose.
|
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 diffrent dataview
object from this dataset, so it don't need to connect to database everytime
.. I know I can use cache object , but cache object can be deleted
automatically if server's memory is low, is this correct?
Would you like to give me more information about how to improve database
webform...
| |
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 want
to add a dataset to this collection object and send it across. But when it
gets to the web server, its failing.
Any help would be abvised? Is this possible? Can I add a dataset object and
add it into the collection array and pass it across?
|
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
some classes written by me. One of the classes contains a pointer to int
values as a filed. In the definition (implementation) of constructor I
use this pointer to create table of int values with the new operator.
The number of elements of the table is provided by the user during
execution of the...
|
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 Object1 = MyFunction(SomeValue)
And at the end of the process the object will be properly destroyed:
Set Object1 = Nothing
|
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
example in MSND - how to release com object without using Garbace
collector ( because it's simply to slow ). Constuctor of MyResource
which inherits from IDisposable gets one argument - Pointer to an
external unmanaged resource. How to get this Pointer from created com
object?
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |