Can we call garbage collector forcefully in Java?

stackchief

Your thoughts?

StackChiefOG /

Yes but this is NOT recommended...

Garbage collection in Java is non-deterministic. This means you never really know when GC is going to run in Java.

Remember that GC is an automatic process. It kind of does it's own thing and runs on it's own threads. Java is designed for you not to be manually managing memory...

theCodingSavage /

yes

System.gc()

That is all...

EatFreshRupesh /

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

Yuzo_Koyama /

YES