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


Please Help Members By Posting Answers For Below Questions

Name the components that are termed to be Heavy-weight component but available in Light-weight components?

1978


What java is used for?

652


What are the differences between string and stringbuffer?

581


What is byte value?

549


Can we overload the constructors?

553






Define packages in java?

570


What is keyword in oop?

510


Can we call thread start () twice?

509


What is difference between overloading and overriding in java?

521


Can we convert list to set in java?

504


Explain about main thread in java?

604


Is a char always 1 byte?

495


When do you call copy constructor?

548


what is recursion in java

590


Explain different states of a thread in java?

573