Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Why we can not force Garbage Collection?

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


Please Help Members By Posting Answers For Below Questions

List primitive java types?

1016


What restrictions are placed on method overriding in java programming?

981


What are advantages of using Java?s layout managers than windowing systems?

2350


Why can we not override static method?

1094


When we serialize an object does the serialization mechanism saves its references too?

1004


Which programming language is best in future?

942


How do you pass by reference?

1026


How can a gui component handle its own events?

1084


How to sort a collection of custom Objects in Java?

1035


When will you define a method as static?

1069


How is garbage collection controlled?

1156


What is use of inner class in java?

1117


'A class is a template for an object' explain this statement.

1039


In the below example, what will be the output?

1012


Does anyone still use java?

1095