How do I run garbage collector from shell?


You can suggest JBoss to run the garbage collector in different ways: however not many know that it’s possible to do it from the command line, using the twilddle utility.

Windows users:
C:\jboss-4.2.2.GA\bin>twiddle invoke “jboss.system:type=Server” runGarbageCollector
Unix users:
[bin]$ ./ invoke jboss.system:type=Server runGarbageCollector

Then you should see from the server log the following message:

13:52:39,281 INFO  [Server] Hinted to the JVM to run garbage collection
13:52:39,281 INFO  [Server] Total/free memory: 170065920/139849848