What are the differences between System.gc() and Runtime.gc()?

John Mitchell

The methods are basically equivalent. Both suggest to the JRE that it might be a good idea if the garbage collector actually does some work now.

Specifically, System.gc() is a static method so it's a wee bit more convenient to use rather than having to do e.g., Runtime.getRuntime().gc().