next up previous
Next: Stack of activation records Up: Unit 11 Previous: Run-time memory management

Heap management and garbage collection

The garbage collector is a component of the JVM that is able to detect when an object has no more references that can be used to access the object, and hence is not usable anymore and can be deallocated. Typically, the garbage collector is invoked automatically by the JVM, without any control by the programmer, when it is necessary to make memory available. However, the programmer can also choose to invoke the garbage collector explicitly, by calling the static method gc() of the class System.


next up previous
Next: Stack of activation records Up: Unit 11 Previous: Run-time memory management