Does garbage collection guarantee that a program will not
run out of memory?
Answer Posted / ranganathkini
Garbage Collection of Java is an automatic mechanism that
safeguards against memory leaks and handles memory
allocation and de-allocation.
The GC makes all possible attempts to free memory and make
it available for fresh allocations. But at certain times it
cannot. At those times, it throws an OutOfMemoryError.
So to conclude, GC handles most of the memory management and
makes all possible attempts to make memory availabe for the
application but it does not gurantee that it will be able to
provide it.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
How is the marker interface used in Java?
What is the difference between hashmap and hashtable? What is an interface?
Can we overload the main() method?
What is r * in math?
How do you create a reference in java?
Differentiate between stringbuffer and stringbuilder in java.
What is the default value of float and double datatype in java?
Will the compiler creates a default constructor if I have a parameterized constructor in the class?
Explain the difference between throw and throws in java?
Why can't you declare a class as protected?
What programs use java?
How are variables stored in memory?
What is static data type in java?
Can we serialize singleton class?
When a byte datatype is used?