Answer Posted / mohit
Hi Friends.. System.gc()does not forcefully to gc.it request
only.it has only 10% chance to run gc.but if u use
thread.sleep(1000);it has chance 50% to run gc.but if u use
for(i=1;i<=1000;i++)
{
System.gc();
}
so it has 99% chance to run gc.because gc release the memory
only when heap is full otherwise JVM is very lasy.....
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
List primitive java types?
What restrictions are placed on method overriding in java programming?
What are advantages of using Java?s layout managers than windowing systems?
Why can we not override static method?
When we serialize an object does the serialization mechanism saves its references too?
Which programming language is best in future?
How do you pass by reference?
How can a gui component handle its own events?
How to sort a collection of custom Objects in Java?
When will you define a method as static?
How is garbage collection controlled?
What is use of inner class in java?
'A class is a template for an object' explain this statement.
In the below example, what will be the output?
Does anyone still use java?