Run garbage collector and finalization methods
void gc()
- Runs the garbage collector.
void runFinalization()
- Runs the finalization methods of any objects pending finalization.
public class Main {
public static void main(String[] args) {
Runtime runtime = Runtime.getRuntime();
runtime.gc();
runtime.runFinalization();
}
}