Reference counting: Difference between revisions

Content deleted Content added
m External links correction process; see User:Kate/extlinks
added more general introduction, reference counting is not just about garbage collection
Line 1:
== Reference Counting Introduction ==
In [[computer science]], '''reference counting''' is a [[computer memory garbage collection|garbage collection]] algorithm where each object contains a count of the number of [[reference]]s to it held by other objects. If an object's reference count reaches zero, the object has become inaccessible, and it is destroyed.
 
In [[computer science]], '''reference counting''' is a technique of storing the number of references, pointers or handles to a resource such as an object or block of memory. Reference counting forms the basis of a software design pattern used frequently for [[computer memory garbage collection|garbage collection]] algorithms, with which it is most commonly associated.
 
== Reference Counting as a Garbage Collection Algorithm ==
 
InReference [[computercounting science]],is '''referenceoften counting'''known isas a [[computer memory garbage collection|garbage collection]] algorithm where each object contains a count of the number of [[reference]]s to it held by other objects. If an object's reference count reaches zero, the object has become inaccessible, and it is destroyed.
 
Simple reference counts require frequent updates. Whenever a reference is destroyed or overwritten, the reference count of the object it references is decremented, and whenever one is created or copied, the reference count of the object it references is incremented.