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 hashing principle in java?
How do you remove duplicates from an array in java?
What is meant by main method?
Can you extend main method in java?
What is the difference between iterator and list iterator?
How do you escape in java?
What is jagged array in java?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
Write a program to print fibonacci series
Can we override tostring method in java?
What is the purpose class.forname method?
What is a loop java?
What is function overriding and overloading in java?
Explain the difference between abstraction and encapsulation.
What is arrays fill in java?