Plans | Login    

Briefing Search
Keyword:
Category:

       

    
Author Details
Ayesh Jadhav
hereisayeshaa@gmail.com
crbtech.in/

Generation of Heap in .Net Garbage Collection


This topic is related to heap generation in .net garbage collection you will learn how heap is generated, different working phases, memory reclaim process by crb tech reviews

BriefingWire.com, 5/20/2016 - Different Working Phases in Garbage Collector:

1. Marking Phase:

At this stage, the garbage collector enlists the live objects present.

2. Relocating Phase:

In this stage, the collector updates the memory references of those objects which would be compacted.

3. Compacting Phase:

In this stage, the garbage collector obtains the memory previously owned by the dead objects and compresses the existing objects. This phase shifts the surviving objects towards the older portion of the memory segment.

A Thing About Garbage Collection Algorithm:

The garbage collector figures out if any object in the memory is dead or not being utilized by the application. In the event that such object exists, then the memory utilized by these objects can be recovered. In any case, how does the garbage collector become aware of these objects?

Every single application has an arrangement of roots and these distinguish the storage areas for the objects on the managed heap.

e.g. All of the global, and static pointers and all the local variable/parameter object pointers on the string’s stack in the application are considered to be a part of the roots of the application. All in all, any CPU registers containing pointers to objects in the managed heap are likewise viewed as a part of the application’s roots.

The rundown of dynamic roots is kept up by the JIT compiler and CLR, and is supplied to the garbage collector’s algorithm.

The Memory Reclaim Process:

The garbage collector begins to traverse through the roots and make a diagram or a graph of all the objects that can be reached starting from the roots. The underneath fig. demonstrates a stack with designated objects. In this memory heap, the application roots straightforwardly allude to the objects 1,3,4,6 and object 3 and 6 refers to the objects 8 and 10. Henceforth all these items will turn into the part of the live objects chart.

The objects which are unreachable from the roots of the application, are taken to be garbage as they are not located by the application. Over here, objects with the number 2,5,7 and 9 are considered as dead objects.

The garbage collector will clean the dead ones from the memory heap. In the next step, the live objects will traverse to the older portion of the memory. The Garbage collector also assigns references to the moving objects within the heap. Root references are also included. This is the general process of claiming the memory and reusing it.

Hope this article would prove informative for you to understand the concept of garbage collection. You can join training institutes in pune to enhance your knowledge in .net field.

Related Articles :

Dot Net Release Silver Light Porting Bridge

How .Net DLL Works?

 
 
FAQs | Contact Us | Terms & Conditions | Privacy Policy
© 2026 Proserve Technology, Inc.