Garbage Collection

Garbage collection. What you get from the title of the topic? Well, while we are coding we use variable or memory location. We may need an array initially for storing some initial elements, then we take more arrays while we are manipulating. At some part of the manipulation, it may that we dont need the initial array anymore. I mean it may that we have already took all the elements of the initial array and processed and stored them in another array for furthur processing and dont need the initial array anymore. However, that initial array still remains eating up some memory locations.

However, todays higher level OOP based languages like JAVA has its own feature of freeing-up memory called garbage collection.

Actually, whenever a memory location is no more referenced (that is, used) from a program the garbage collector frees up the memory location and returns it to the memory system. It is a feature of Memory Management. We can also deallocate memory with codes. So garbage collection is a great feature.

Its not easy for programmer that S/He will concentrate on parts of the program where a variable is getting out of use and S/He will write code for deleting those. Thats why garbage collection is very important and necessary.

From Wikipedia (Link to the Complete Post):

      In computer sciencegarbage collection (GC) is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program. Garbage collection was invented by John McCarthy around 1959 to solve problems in Lisp.


Never Miss What"s New !

No SPAM, only email notification if new posts were published.

Recommended Recommends


Contact Us