How do you Force Garbage Collection from the Shell?

Since JDK 7 you can use the JDK command tool ‘jcmd’ such as:

jcmd <pid> GC.run

Leave a Comment