Garbage collection: Difference between revisions
Content added Content deleted
m (Corrected case) |
No edit summary |
||
Line 1: | Line 1: | ||
[[Category:Encyclopedia]]'''Garbage collection''' ( |
[[Category:Encyclopedia]]'''Garbage collection''' (often abbreviated as '''GC''') is a technique used for management of the life time of the object created [[run time|dynamically]], which scope is [[compile time|statically]] indeterminable. Sometimes called "automatic memory management". The object that are no longer in use by the program are said to be "collected," i.e. finalized and the memory allocated for the object is returned to the language environment. |
||
Some [[programming language|programming languages]] (such as [[Java]], [[Tcl]], and [[Toka]]) have integrated GC support. |
|||
A memory location is no longer in use when there are no [[reference|references]] to it in use anymore. For instance (in a language with scope): |
|||
An object is considered not in use when there is no legal way to access it. In particular, when there are no other accessible objects [[reference|referencing]] it. For instance (in a language with scope): |
|||
for i = 1 to 10 |
for i = 1 to 10 |
||
var x = i * i |
var x = i * i |