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
Can we change the scope of the overridden method in the subclass?
Can we declare array without size in java?
How will you reverse a link list without using recursion?
What are serialization and deserialization?
How you can force the garbage collection?
How to add menushortcut to menu item?
Can we override private method in java?
Which method returns the length of a string?
Which class should you use to obtain design information about an object in java programming?
Implement 2 stacks with just 1 array. The stack routines must not indicate overflow unless every slot in array is used.
What are the types of methodology?
What’s the difference between applets and standalone program?
what do you mean by classloader?
What are internal and external variables?
Is list thread safe in java?