473,408 Members | 2,839 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,408 software developers and data experts.

garbage collection

hi,
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i closed
the form it is already taking 80 mb memory. where is garbage collection? i am
waiting 30 minutes but memory usage is not decreasing. what must i do?
thanks,
Ömer KUL
Jul 21 '05 #1
14 1509
Have a look at
http://getdotnetco.web101.discountas...%20Mystery.htm

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
hi,
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i
closed
the form it is already taking 80 mb memory. where is garbage collection? i
am
waiting 30 minutes but memory usage is not decreasing. what must i do?
thanks,
Ömer KUL

Jul 21 '05 #2
hi Hederman,
i have read the article. thank you very much for your help. the article is
very helpful but it is not answering my question. i am opening a form and
memory usage is increasing(80 mb), after that i am closing it but memory
usage is not decreasing. whenever i open the form memory usage is increasing
80 mb and going on so... that is the problem...
thanks
Ömer KUL

"Sean Hederman":
Have a look at
http://getdotnetco.web101.discountas...%20Mystery.htm

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
hi,
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i
closed
the form it is already taking 80 mb memory. where is garbage collection? i
am
waiting 30 minutes but memory usage is not decreasing. what must i do?
thanks,
Ömer KUL


Jul 21 '05 #3
If you're not holding any references to your datasets then the CLR will free
the memory when it needs to, not on some schedule. So the point would be to
ensure that the references to your datasets are being cleared.

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:05**********************************@microsof t.com...
hi Hederman,
i have read the article. thank you very much for your help. the article is
very helpful but it is not answering my question. i am opening a form and
memory usage is increasing(80 mb), after that i am closing it but memory
usage is not decreasing. whenever i open the form memory usage is
increasing
80 mb and going on so... that is the problem...
thanks
Ömer KUL

"Sean Hederman":
Have a look at
http://getdotnetco.web101.discountas...%20Mystery.htm

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
> hi,
> i have a garbage collection problem. i have an application writen by
> vb.net, i am opening a form and in this form there is a big query. when
> i
> open the form, it takes 80 mb memory because of the data table. when i
> closed
> the form it is already taking 80 mb memory. where is garbage
> collection? i
> am
> waiting 30 minutes but memory usage is not decreasing. what must i do?
> thanks,
> Ömer KUL


Jul 21 '05 #4
Task Manager doesn't always show memory usage correctly. To see this follow
these steps:

- Create a new Windows Forms application
- Run it
- Check memory usage in Task Manager
- My computer shows 15,554 K
- Minimize the app
- Check memory usage in Task Manager
- My computer shows 864 K
- Restore the app
- Check memory usage in Task Manager
- My computer shows 1,784 K

Try minimizing the app after you close the form and see if the memory usage
changes.

--
Rob Windsor [MVP-VB]
G6 Consulting
Toronto, Canada
http://msmvps.com/windsor/

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:05**********************************@microsof t.com...
hi Hederman,
i have read the article. thank you very much for your help. the article is
very helpful but it is not answering my question. i am opening a form and
memory usage is increasing(80 mb), after that i am closing it but memory
usage is not decreasing. whenever i open the form memory usage is
increasing
80 mb and going on so... that is the problem...
thanks
Ömer KUL

"Sean Hederman":
Have a look at
http://getdotnetco.web101.discountas...%20Mystery.htm

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
> hi,
> i have a garbage collection problem. i have an application writen by
> vb.net, i am opening a form and in this form there is a big query. when
> i
> open the form, it takes 80 mb memory because of the data table. when i
> closed
> the form it is already taking 80 mb memory. where is garbage
> collection? i
> am
> waiting 30 minutes but memory usage is not decreasing. what must i do?
> thanks,
> Ömer KUL


Jul 21 '05 #5

"Rob Windsor [MVP]" <ro*****************@gmail.com> wrote in message
news:OK**************@TK2MSFTNGP09.phx.gbl...
Task Manager doesn't always show memory usage correctly. To see this
follow these steps:

- Create a new Windows Forms application
- Run it
- Check memory usage in Task Manager
- My computer shows 15,554 K
- Minimize the app
- Check memory usage in Task Manager
- My computer shows 864 K
- Restore the app
- Check memory usage in Task Manager
- My computer shows 1,784 K

Try minimizing the app after you close the form and see if the memory
usage changes.

And what makes you think this isn't correct here?
The OS automatically reduces the workingset of a windows application
(any)when minimizing, this has been done since NT4 was introduced years ago.
Taskman takes it's values from the preformance counters, do you mean that
these aren't correct?

Willy.
Jul 21 '05 #6

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
hi,
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i
closed
the form it is already taking 80 mb memory. where is garbage collection? i
am
waiting 30 minutes but memory usage is not decreasing. what must i do?
thanks,
Ömer KUL


When there is no garbage, there is nothing to collect, that's how the GC
works, so in your case there is no garbage because you are still holding
references to your Data Tables. Please post your code if you want to get any
more help.

Willy.
Jul 21 '05 #7
Hi Willy,
i am closing the form that increases the memory usage. are not the all
variables and controls on the form disposed? after now, does not the GC
collect them?
i can not send you all code, because it is an ERP packet and it is 50 mb
when zipped. i can send you code samples if you want.
thanks
Ömer KUL

"Willy Denoyette [MVP]":

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
hi,
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i
closed
the form it is already taking 80 mb memory. where is garbage collection? i
am
waiting 30 minutes but memory usage is not decreasing. what must i do?
thanks,
Ömer KUL


When there is no garbage, there is nothing to collect, that's how the GC
works, so in your case there is no garbage because you are still holding
references to your Data Tables. Please post your code if you want to get any
more help.

Willy.

Jul 21 '05 #8
Ömer KUL wrote:
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i closed
the form it is already taking 80 mb memory. where is garbage collection? i am
waiting 30 minutes but memory usage is not decreasing. what must i do?


Merely waiting won't do anything - garbage collection is triggered by
allocations, not a timer.

--

www.midnightbeach.com
Jul 21 '05 #9
"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
Hi Willy,
i am closing the form that increases the memory usage. are not the all
variables and controls on the form disposed? after now, does not the GC
collect them?
No, only those variables that are only referenced on the form will be
available for GC, and just because they're available doesn't mean they will
be GC'd.
i can not send you all code, because it is an ERP packet and it is 50 mb
when zipped. i can send you code samples if you want.
thanks
Ömer KUL

"Willy Denoyette [MVP]":

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
> hi,
> i have a garbage collection problem. i have an application writen by
> vb.net, i am opening a form and in this form there is a big query. when
> i
> open the form, it takes 80 mb memory because of the data table. when i
> closed
> the form it is already taking 80 mb memory. where is garbage
> collection? i
> am
> waiting 30 minutes but memory usage is not decreasing. what must i do?
> thanks,
> Ã-mer KUL


When there is no garbage, there is nothing to collect, that's how the GC
works, so in your case there is no garbage because you are still holding
references to your Data Tables. Please post your code if you want to get
any
more help.

Willy.

Jul 21 '05 #10
"Sean Hederman" <em*******@codingsanity.blogspot.com> wrote in message
news:d6**********@ctb-nnrp2.saix.net...
No, only those variables that are only referenced on the form will be
available for GC, and just because they're available doesn't mean they
will be GC'd.


right away
Jul 21 '05 #11
Hi Omer,
i can not send you all code, because it is an ERP packet and it is 50 mb
when zipped. i can send you code samples if you want.
thanks

Typically we ask that you post only the code snippets that you believe are
causing your problem or which form a basis for you to believe that the code
"should" work. In this case, it would be helpful if you would post the
calls that fetch the data, and enough information for us to know where the
references are stored for the data (on the stack or on the heap). Also, it
would be helpful if you would post the code that occurs when you opened and
closed the form.

Notes:

80Mb is a very large amount of data. Is there any way you can reduce the
amount of data that has to be returned by being more explicit in your
queries? There is no reasonable way for me to believe that you are actually
presenting 80Mb worth of data to the user... so clearly you are returning
some data that you don't need.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com... Hi Willy,
i am closing the form that increases the memory usage. are not the all
variables and controls on the form disposed? after now, does not the GC
collect them?
i can not send you all code, because it is an ERP packet and it is 50 mb
when zipped. i can send you code samples if you want.
thanks
Ömer KUL

"Willy Denoyette [MVP]":

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
> hi,
> i have a garbage collection problem. i have an application writen by
> vb.net, i am opening a form and in this form there is a big query. when
> i
> open the form, it takes 80 mb memory because of the data table. when i
> closed
> the form it is already taking 80 mb memory. where is garbage
> collection? i
> am
> waiting 30 minutes but memory usage is not decreasing. what must i do?
> thanks,
> Ã-mer KUL


When there is no garbage, there is nothing to collect, that's how the GC
works, so in your case there is no garbage because you are still holding
references to your Data Tables. Please post your code if you want to get
any
more help.

Willy.

Jul 21 '05 #12
Omar,

I found the replys from Willy and Sean very clear. Now that there is a new
message added, I will try to explain their messages something more.

When you have done in by instance (I see not the code you use therefore in
VBNet)

In form1
Private myDatatable as Datatable
dim frm as new Form2
frm.datatablefrm2 = myDatatable
frm Show

And you have in your Form2
datatablefrm2 = new datatable.

Than the memory used by that datatable will released by the GC as soon as
there are no references any more in that datatable and set to nothing in
form1 (or that both forms are closed)

It is a strange way of coding by the way, however this can give the effect
you are talking about.

I hope this gives an idea

Cor
Jul 21 '05 #13
hi Willy,
i am using a variable that declared as datatable. i get data from query and
set the datatable. after i used the datatable i dispose it but the memory
usage is not decreasing. the datatable gets about 80 mb memory...
if you give me your e-mail i can send your code part.
thanks for your helps.
Ömer KUL

"Willy Denoyette [MVP]":

"Ömer KUL" <me****@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
hi,
i have a garbage collection problem. i have an application writen by
vb.net, i am opening a form and in this form there is a big query. when i
open the form, it takes 80 mb memory because of the data table. when i
closed
the form it is already taking 80 mb memory. where is garbage collection? i
am
waiting 30 minutes but memory usage is not decreasing. what must i do?
thanks,
Ömer KUL


When there is no garbage, there is nothing to collect, that's how the GC
works, so in your case there is no garbage because you are still holding
references to your Data Tables. Please post your code if you want to get any
more help.

Willy.

Jul 21 '05 #14
Omer,

Disposing a datatable does almost nothing, however using clear can help you
with the datatable and with the dataset.

http://msdn.microsoft.com/library/de...cleartopic.asp

When that does not help, you can as quick fix as well try the
dataset.Tables[x].Remove;
in the closing method of that form.

I hope this helps,

Cor


Jul 21 '05 #15

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

Similar topics

1
by: Bob | last post by:
Are there any known applications out there used to test the performance of the .NET garbage collector over a long period of time? Basically I need an application that creates objects, uses them, and...
6
by: Ganesh | last post by:
Is there a utility by microsoft (or anyone) to force garbage collection in a process without have access to the process code. regards Ganesh
11
by: Rick | last post by:
Hi, My question is.. if Lisp, a 40 year old language supports garbage collection, why didn't the authors of C++ choose garbage collection for this language? Are there fundamental reasons behind...
34
by: Ville Voipio | last post by:
I would need to make some high-reliability software running on Linux in an embedded system. Performance (or lack of it) is not an issue, reliability is. The piece of software is rather simple,...
5
by: Bob lazarchik | last post by:
Hello: We are considering developing a time critical system in C#. Our tool used in Semiconductor production and we need to be able to take meaurements at precise 10.0 ms intervals( 1000...
8
by: mike2036 | last post by:
For some reason it appears that garbage collection is releasing an object that I'm still using. The object is declared in a module and instantiated within a class that is in turn instantiated by...
28
by: Goalie_Ca | last post by:
I have been reading (or at least googling) about the potential addition of optional garbage collection to C++0x. There are numerous myths and whatnot with very little detailed information. Will...
56
by: Johnny E. Jensen | last post by:
Hellow I'am not sure what to think about the Garbage Collector. I have a Class OutlookObject, It have two private variables. Private Microsoft.Office.Interop.Outlook.Application _Application =...
350
by: Lloyd Bonafide | last post by:
I followed a link to James Kanze's web site in another thread and was surprised to read this comment by a link to a GC: "I can't imagine writing C++ without it" How many of you c.l.c++'ers use...
158
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is...
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?
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
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.