What is garbage collection | Eklavya Online

What is garbage collection

The runtime system keeps track of the memory that is allocated and is able to

determine whether that memory is still useable. This work is usually done in

background by a low-priority thread that is referred to as garbage collector. When the

gc finds memory that is no longer accessible from any live thread it takes steps to

release it back to the heap for reuse