garbage collection

 

  Garbage collection can never be forced, just suggested.  It may never occur at all.

 

  Only class (object) instances are collected, not primitive variables.  These are re-created with every invocation of their code block.

 

  Two ways to suggest garbage collection are:

 

System.gc( );

Runtime.getRunTime( ).gc( );