Garbage collection is a method to detect and collect free nodes. The node which is in use and allocated are not detected whereas any no longer in use is recovered.
When a request is made for additional nodes and there are none available, then a system routine is called garbage collector searches through all of the nodes in the system and identifies those that are no longer accessible from an external pointer, and restores the inaccessible nodes to the available pool.
The Process of garbage collection takes place into two-phase. The first phase is called making phase, where all nodes are accessible from an external pointer are marked.
The second phase is called the collection phase, involves proceeding sequentially through memory and freeing all nodes that have not been marked. This second phase is trivial when all nodes are of fixed size. In this case, the second phase requires only the examination of each node to see whether or not it has been marked.
If there are a total of n nodes then the second phase of garbage collection can be carried out in O(n) steps. In this situation, it is only the first or marking phase that is of any interest in designing the algorithm.
When variable size nodes are in use, it is desirable to compact memory so that all free nodes from a contiguous block of memory. In this case, the second phase is referred to as memory compaction of disk space to reduce average retrieval time is desirable even for fixed-size nodes.
Garbage collection is a simple phenomenon of releasing the memory from those objects which are no longer used in the program. When we create a variable function or any object while developing the program then once the use of these objects is over the garbage collector detects all such object and free the memory block by taking the resource from these objects, so that it can be used by another variable or function.
In the case of any queries, you can write to us at firstname.lastname@example.org we will get back to you ASAP.
Hope! you would have enjoyed this post about Garbage collection.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!
- What is the use of Cache Memory 2019?
- Overlay advantages and disadvantages in programs?
- FAT32 Advantages and Disadvantages?
- What Is Disk Scheduling In Hindi? disk scheduling क्या होती है?
- Deadlock in the distributed operating system in Hindi? डैडलॉक क्या होता है?
- Remove unwanted characters in word file in Hindi? वर्ड(Word) फाइल के एक कॉलम में दिए गए नंबर्स के शुरू के कुछ नंबर्स को हटाना ?
- Important facts about Gmail in Hindi? Gmail के बारे में कुछ रोचक तथ्य?
- Software Maintenance Issues & Problem in Hindi? सॉफ्टवेयर मेंटेनेंस मुद्दा और दिक्कते हिंदी में
- What is Requirement engineering in Hindi& Requirement analysis?रेक्विरेमेंट इंजीनियरिंग क्या होता है?
- White Box Testing in Hindi? वाइट बॉक्स टेस्टिंग क्या है हिंदी में?