can we call the garbage collector to run explicicitly?
Answers were Sorted based on User's Feedback
Answer / velu s
Yes we can call the Garbage collector explicitly by using
method Collect().
Ex. Create object for the Garbage collector.
GarbageCollector Gc = new GarbageCollector();
Gc.Collect();
| Is This Answer Correct ? | 16 Yes | 1 No |
Answer / rakesh
not required to create object
we can call directly
System.GC.Collect();
| Is This Answer Correct ? | 6 Yes | 0 No |
Answer / sri4u_926
s we can cal Gc explisitly but it Reduces the performance.
| Is This Answer Correct ? | 3 Yes | 0 No |
But forcefully calling Garbage collector reduces the
performance. As when CLR runs Garbage collector
automatically it checks all the objects which are not used
for a long time and remove them. But if we use
System.GC.Collect(), it will shift the particular object to
cache. When CLR founds no object which is made to be free
then it will check the cache memory from there it will
remove that very object. So, how it is reducing the performance.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / lalitprakash baraik
Yes it is possible.The Gargabe collector class is named as GC and is found in the 'System' namespace.GC is a static class and the Collect method itself is static.There fore you can directly call the Collect() method without creation of an object to access the method.
GC.Collect()
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / xyz
we can call the garbage collection explicitly but performing a garbage collection is totally dependent on the JVM. So calling System.gc() does not necessarily performing the garbage collection.
--
XYZ
| Is This Answer Correct ? | 2 Yes | 3 No |
What are the options can be configured in AJAX helpers?
How does assembly versioning work?
What is the need of Action Filters in ASP.Net MVC
If you are using components in your application, how can you handle exceptions raised in a component ?
4 Answers Accenture, BirlaSoft,
Explain the methods used to render the views in ASP.Net MVC?
What is Separation of Concerns in ASP.NET ASP.Net MVC?
i just want to write an exam regarding .net?plz give me information about taking a test?where to pay 4 d exam,exam centre?
what are generics? Without generics what are the disadvantages in 1.1?
3 Answers HP, iSoft, nTech Solutions,
What is serialization in .NET? What are the ways to control serialization?
What are Scaffold templates in ASP.Net MVC?
Explain what languages does the .net framework support?
What is the .net framework?