Tuesday 3 June 2014

How the programmer will explicitly called for the Garbage collection?

      Some interviewer will ask this question to check the basics of garbage collection.

Answer:By calling System.gc().
             
      You need to be very careful if you call System.gc(). Calling it can add unnecessary performance issues to your application, and it is not guaranteed to actually perform a collection. You don't call anywhere in your application. JVM will handle it internally. Just you know this thing.
       For more details click on this link http://stackoverflow.com/questions/66540/when-does-system-gc-do-anything

No comments:

Post a Comment