top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Java : Can we force Garbage collector to run at any time ?

+1 vote
47 views
Java : Can we force Garbage collector to run at any time ?
posted Jun 20, 2016 by Karthick.c

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

No, you don't have an option to force garbage collection. The only closest thing we have in Java is System.gc() which intimates or requests the JVM to collect garbage. By which JVM most of the time does GC after the call, sometimes it postpones based on the resource utilization, etc., sometimes it doesn't.

Summary: use System.gc()

answer Jun 20, 2016 by Vinod Kumar K V
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...