Saturday, 1 October 2016

Different ways to call Garbage Collection In Java ?

This blog is all about to learn Core Java Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.



* Garbage Collection help us to free memory from unused objects.

* Garbage Collection  is a Deamon Thread which run behind the application , and this thread is started by JVM itself.

* The Garbage Collection can not be forced, though there are few ways by which it can be requested there is no guarantee that these requests will be taken care by JVM.

* In Java There are Two ways to call Garbage Collection , gc() method of Garbage Collection belongs to java.lang package.

1 ) System.gc();
2 ) Runtime.getRuntime().gc();

No comments:

Post a Comment