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
What is meant by bytecode?
How many types of threads are there in java?
How can I become a good programmer?
Can subclass overriding method declare an exception if parent class method doesn't throw an exception?
What are namespaces in java?
What is callable java?
how does the run() method in runnable work? : Java thread
What is the difference between Error, defect,fault, failure and mistake?
Define array. Tell me about 2-D array.
Explain java coding standards for constants?
What is variable and its types?
What is a line break example?
Where are variables stored?
What is json parser in java?
How do you detect memory leaks?