Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Is it possible to force jvm for garbage collection? if yes then how?

user-image
Question added by himanshu mittal
Date Posted: 2013/06/26

no no u can never force the jvm for garbage collection.
System.gc() method only sends the request to jvm for the garbage collection.
its all depend on jvm wheather it has to run the garbage collector or not.

Deleted user
by Deleted user

simply call the system garbage collector System.gc(), for more information see the gc() documentation....
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/System.html#gc()

Deleted user
by Deleted user

System.gc() doesn't perform the proper GC tasks, it just makes the object a candidate for the GC.

More Questions Like This