Dotnet framework has a special feature as automatic memory management .It is down with the help of garbage collector in CLR.mainly this process involves the following 1.Allocating memory: 2.Releasing memory: 3.Implementing finalizes:
Allocating memory: Automatically allocate objects in the heap at runtime .The memory heap keeps the pointer where the next object is to be placed .when the new object is created it will allocate memory in the heap orderly .so the pointer incremented after the object is created. It will allocate memory with in the less time.
Releasing memory: When the there is a insufficient memory we have to release the unused objects in the memory. This is taken care by garbage collector. Garbage collector is having all the unused objects.It will divide all the unused objects into three generations 0,1,and 2 and placed into heap.0 generation will contain most recently created objects, and 1, 2 are latter created objects.So when there is in sufficient memory in the 0 generated objects then automatically the least generated objects like 1,2 will be deleted. So when there is insufficient memory in the objects automatically it will be deleted and allocate memory for that.
Implementing finalizer:To de-allocate objects in the memory Garbage collector call the dispose method to dispose the unused objects that are there in the memory.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|