System.gc() vs. Runtime.gc()
There is no difference !
System.gc() internally calls Runtime.gc()
public static void gc() {
Runtime.getRuntime().gc();
}
Runtime.getRuntime() provides singleton instance and then it calls its native method gc()
These methods sends request of Garbage collection to JVM but it’s not guaranteed that garbage collection will happen.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.