Skip to main content

Posts

Showing posts from September, 2014

A look on Java Garbage Collector..

A garbage collector is responsible for • allocating memory • ensuring that any referenced objects remain in memory, and • recovering memory used by objects that are no longer reachable from references in executing code. Objects that are referenced are said to be live. Objects that are no longer referenced are considered dead and are termed garbage. The process of finding and freeing (also known as reclaiming) the space used by these objects is known as garbage collection. Garbage collection solves many, but not all, memory allocation problems. You could, for example, create objects indefinitely and continue referencing them until there is no more memory available. Garbage collection is also a complex task taking time and resources of its own. The precise algorithm used to organize memory and allocate and deallocate space is handled by the garbage collector and hidden from the programmer. Space is commonly allocated from a large pool of memory referred to as the heap.