What is garbage collection?
Garbage collection is a CLR feature which automatically manages memory. Programmers forget to release the objects while coding ..... laziness ( Remember in VB6 where one of the good practices is to set object to nothing).CLR automatically releases objects when they are no longer referenced and in use.CLR runs on non-deterministic to see the unused objects and cleans them.
One side effect of this non-deterministic feature is that we cannot assume an object is destroyed when it goes out of the scope of a function. Therefore, we should not put code into a class destructor to release resources.
(I) Can we force garbage collector to run ?
System.GC.Collect() forces garbage collector to run.This is not recommended but can be used if situations arises.
Wednesday, 26 June 2013
Garbage Collection
Published June 26, 2013
Artikel Terkait
- What is a CLR? Full form of CLR is Common Language Runtime and it forms the heart of the
- What is the Scope of public/private/friend/protected/protected friend? Scope of public/p
- What is .NET / .NET Framework? It is a Framework in which Windows applications may be
- 1. What are the main properties of object oriented programming? There are mainly 3
- How to clear a datagrid on a button click? You need to Clear the DataSource of the dadaG
- 11. Can we use access modifier on static constructor? a ) No 12. How many static const
Subscribe to:
Post Comments (Atom)
EmoticonEmoticon