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.
C:\jboss-4.2.2.GA\bin>twiddle invoke “jboss.system:type=Server” runGarbageCollector
[bin]$ ./twiddle.sh 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