If one of your classes contains a static reference to an object, this object will not be garbage collected until your class is unloaded. If your class was loaded by the bootstrap classloader this in unlikely to happen until your program finishes. If it was loaded by a CustomClassLoader, then the variables will be subject to GC when the classloader is ...