Does garbage collection guarantee that a program will not
run out of memory?



Does garbage collection guarantee that a program will not run out of memory?..

Answer / 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

More Core Java Interview Questions

Difference between an argument and a parameter?

10 Answers   Accounting, HCL, IBM, Quinnox,


What exactly is methodology?

0 Answers  


What is the synonym of procedure?

0 Answers  


What is parsing in java?

0 Answers  


Iterator in the HashMap is fail-safe means what?

9 Answers   CTS, IBM, Subex,






Is empty string in java?

0 Answers  


How do you add an element to a hashset in java?

0 Answers  


Why arraylist is not synchronized in java example?

0 Answers  


What is the difference between a local variable and an instance variable?

0 Answers  


Where can I find data structures question and answers with comprehensive working code written in Java

0 Answers   Amazon,


How many threads can java run?

0 Answers  


What is the difference between multiple processes and multiple threads?

0 Answers  


Categories