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

Declaring a garbage collector

Hi,

Is there a way to delcare a garbage collector in VB.NET 2005?

Thanks,
Adam
May 7 '06 #1
8 1053
Adam,

Can you tell more what you mean with "a" garbage collector?

Cor

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:eP**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is there a way to delcare a garbage collector in VB.NET 2005?

Thanks,
Adam

May 7 '06 #2
Like in Java where they have a sub that's called when the program is to
terminate.

It releases any used resources and basically cleans up.

Adam

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eu**************@TK2MSFTNGP04.phx.gbl...
Adam,

Can you tell more what you mean with "a" garbage collector?

Cor

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:eP**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is there a way to delcare a garbage collector in VB.NET 2005?

Thanks,
Adam


May 7 '06 #3
Adam,

That is one of the main differences between Java and Net and why it is
called Managed Code. Net does that for you on the best time. You would not
wanted to force that. (Which is possible, however will cost a lot of total
throughput time)

Cor

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:eZ**************@TK2MSFTNGP05.phx.gbl...
Like in Java where they have a sub that's called when the program is to
terminate.

It releases any used resources and basically cleans up.

Adam

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eu**************@TK2MSFTNGP04.phx.gbl...
Adam,

Can you tell more what you mean with "a" garbage collector?

Cor

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:eP**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is there a way to delcare a garbage collector in VB.NET 2005?

Thanks,
Adam



May 7 '06 #4
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
That is one of the main differences between Java and Net and why it is
called Managed Code. Net does that for you on the best time.


Java and .NET have similar garbage collectors...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
May 7 '06 #5
Herfried,

If I had not you,

This is was what I had understood from our Java Guru in these newsgroups, I
probably have understood him wrong.

Cor

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
"Cor Ligthert [MVP]" <no************@planet.nl> schrieb:
That is one of the main differences between Java and Net and why it is
called Managed Code. Net does that for you on the best time.


Java and .NET have similar garbage collectors...

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

May 7 '06 #6

Hello Adam

let me try to shine some light on the subject :-)
In java when you want to invoke the GC you need to do this

Runtime objFoo = Runtime.getRuntime();
objFoo.gc();
in .Net however the GC is in the system namespace
so the equivalant for above java code would be GC.Collect()

However as Cor mentioned calling the GC.Collect method to cause an induced
garbage collection is usually a bad idea

The only valid situation i can think of is when the application is idle and
if you see that unexpected garbage collections are slowing down the
application during time critical operations ( example : your program is in
charge of controling hardware devices that require a short response time )

In all other situations i would say , let the GC doe it`s work as how it was
intended to do so , as this gives you the highest performance

Regards

And happy coding :-)

Michel Posseth [MCP]

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:eP**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is there a way to delcare a garbage collector in VB.NET 2005?

Thanks,
Adam

May 7 '06 #7
Use the Closing or Closed events. (FormClosing or FormClosed in .NET 2.0).

The first one occurs before the form is closed, and gives you the
opportunity to stop the form from closing. The second one occurs after
the form is closed.

Adam Honek wrote:
Like in Java where they have a sub that's called when the program is to
terminate.

It releases any used resources and basically cleans up.

Adam

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eu**************@TK2MSFTNGP04.phx.gbl...
Adam,

Can you tell more what you mean with "a" garbage collector?

Cor

"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in bericht
news:eP**************@TK2MSFTNGP03.phx.gbl...
Hi,

Is there a way to delcare a garbage collector in VB.NET 2005?

Thanks,
Adam


May 7 '06 #8
Adam,
It sounds like you want to declare a Finalizer.

A Finalizer is used to "releases any used resources and basically cleans
up".

Generally if you are declaring a Finalizer you also want to implement
IDisposable.

For more infor on implementing Finalizers & Disposable see:

http://msdn.microsoft.com/msdnmag/is...05/NETMatters/

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

http://msdn.microsoft.com/library/de...izeDispose.asp
--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> wrote in message
news:eZ**************@TK2MSFTNGP05.phx.gbl...
| Like in Java where they have a sub that's called when the program is to
| terminate.
|
| It releases any used resources and basically cleans up.
|
| Adam
|
| "Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
| news:eu**************@TK2MSFTNGP04.phx.gbl...
| > Adam,
| >
| > Can you tell more what you mean with "a" garbage collector?
| >
| > Cor
| >
| > "Adam Honek" <Ad*******@Webmaster2001.freeserve.co.uk> schreef in
bericht
| > news:eP**************@TK2MSFTNGP03.phx.gbl...
| >> Hi,
| >>
| >> Is there a way to delcare a garbage collector in VB.NET 2005?
| >>
| >> Thanks,
| >> Adam
| >>
| >
| >
|
|
May 8 '06 #9

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

Similar topics

10
by: pachanga | last post by:
The Hans-Boehm garbage collector can be successfully used with C and C++, but not yet a standard for C++.. Is there talks about Garbage Collector to become in the C++ standard?
13
by: Mingnan G. | last post by:
Hello everyone. I have written a garbage collector for standard C++ application. It has following main features. 1) Deterministic Finalization Providing deterministic finalization, the system...
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...
142
by: jacob navia | last post by:
Abstract -------- Garbage collection is a method of managing memory by using a "collector" library. Periodically, or triggered by an allocation request, the collector looks for unused memory...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.