System.gc() and RunTime.gc()

Posted: October 14, 2011 in Java

Every Java application has a single instance of class Runtime that allows the application to interface with the environment in which the application is running. The current runtime can be obtained from the getRuntime method.

System.gc() and RunTime.gc() JVM suggests to the JVM that now might be a good time for some garbage collection, but doesn’t force garbage Collection.

Infact System.gc() is equivalent to RunTime.getRunTime.gc()

So, there is no difference in these two at all.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s