Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any differences in the garbage collector for vb.net and c#?

I've heard that the c# garbage collector can be 'more aggressive' than it's vb.net counterpart. Is this true? Are there any other differences in how garbage collection is run in vb.net vs. c#?

like image 800
Matthew Vines Avatar asked Mar 09 '12 16:03

Matthew Vines


People also ask

Is there a garbage collector in C?

C does not have automatic garbage collection. If you lose track of an object, you have what is known as a 'memory leak'. The memory will still be allocated to the program as a whole, but nothing will be able to use it if you've lost the last pointer to it. Memory resource management is a key requirement on C programs.

Why there is no garbage collector in C?

There are two reasons why C / C++ doesn't have garbage collection. It is "culturally inappropriate". The culture of these languages is to leave storage management to the programmer. It would be technically difficult (and expensive) to implement a precise garbage collector for C / C++.

How does the garbage collector work in C#?

Garbage collection (GC) is a memory recovery feature built into programming languages such as C# and Java. A GC-enabled programming language includes one or more garbage collectors (GC engines) that automatically free up memory space that has been allocated to objects no longer needed by the program.

How many garbage collectors are there in C#?

There are mainly 3 phases in garbage collection. Details about these are given as follows: Marking Phase: A list of all the live objects is created during the marking phase. This is done by following the references from all the root objects.


1 Answers

It's my understanding that the CLR maintains garbage collection and is not language-specific.

like image 86
Lynn Crumbling Avatar answered Oct 27 '22 15:10

Lynn Crumbling