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

What is the size of integer?

0 Answers  


Explain the usage of this with constructors?

0 Answers  


What is the functionality of Webserver?

2 Answers  


Write code to implement bubble sort in java?

0 Answers  


What language is an assembler written in?

0 Answers  


Explain the concept of polymorphism with examples?

6 Answers   Summation Tech,


Explain different data types in Java.

5 Answers  


What is linkedlist in java?

0 Answers  


what is the logic inside any default constuctor?

2 Answers  


Is set thread safe java?

0 Answers  


Can we write any code after throw statement?

0 Answers  


is there any function in java to make the text to blink?

6 Answers  


Categories