CTS
Company
Programming
Technical
what is a garbage collector
Read Solution (Total 6)
-
- It frees memory allocated to objects that are not being used by the program any more - hence the name "garbage". For example:
public static Object otherMethod(Object obj) {
return new Object();
}
public static void main(String[] args) {
Object myObj = new Object();
myObj = otherMethod(myObj);
} - 10 years agoHelpfull: Yes(6) No(0)
- Garbage Collector is part of JRE that makes sure that object that are not referenced will be freed from memory.
It usually runs when you app runs out of memory. AFAIK it holds a graph that represents the links between the objects and isolated objects can be freed.
To save performance the current objects grouped into generations, each time GC scans an object and finds that it is still referenced its generation count incremented by 1 (to some max maximum value, 3 or 4 i think) , and the new generation are scanned first (the shortest the object in memory the more probably it is no longer needed) so not all objects being scanned every time GC run. - 10 years agoHelpfull: Yes(2) No(0)
- garbage means unreferenced objects garbage collector is used to destroy the unused objects
- 9 years agoHelpfull: Yes(1) No(0)
- garbage collector converts used memory into unused.......when its longer no used
an also it handles automatic memory management - 10 years agoHelpfull: Yes(0) No(1)
- it is automated memory allocation in java programming language.
- 10 years agoHelpfull: Yes(0) No(2)
- A garbage collector is a program that collects the space not utilize by any process.
In java, JVM provides the environment for the garbage collector - 10 years agoHelpfull: Yes(0) No(0)
CTS Other Question