Guest User
How does Garbage collector locate Garbage?
By Guest User in .NET on Aug 01 2014
  • sarang Chandaikar
    Aug, 2014 7

    There are three generations. Gen0, Gen1, Gen2 Whenever objects are created they are kept into Gen0 bucket. Garbage collector visits to Gen0 quite frequently. if any objects are are not referencing to any anybody, in other terms if it is assigned to null, then this object is moved to garbage collection queue from there the object is removed.longer the object resides into Gen0 its is subsequently moved to Gen1 and then Gen2 buckets.

    • 1
  • Raghav Mehra
    Aug, 2014 26

    Garbage Collection is a memory management and automatically recycling the heap memory. The collector recycles the memory that is not referencing and that can prove will never be used again. By collector it is assumed that when something is no longer needed, it is no longer referenced. This can be detected and the widget collected. Reference Counting: each object contains a counter saying how many references to it there are. When you refer to an object, you increment the counter. When you're done with it, you decrement the counter. When the counter reaches 0, the object can be recycled.Stop And Copy: The heap is divided into two regions. One contains objects, and the other is empty. You recursively traverse all the objects in the first region (as in mark-and-sweep), copying them into the second region. Then you interchange the roles of the two regions. No need to scan the unused objects in the first region.

    • 0
  • lv prasad
    Aug, 2014 16

    By using WeekReference Object it will find out the unused object and it will clear.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS