reference counting
nounUK /ˈrɛf.rəns ˈkaʊn.tɪŋ/
US /ˈrɛf.rəns ˈkaʊn.tɪŋ/
A way for a computer to keep track of how many things are using a piece of memory so it knows when to clean it up.
The program uses reference counting to free memory as soon as no one needs it anymore.
OTHER MEANINGS
2. A technique in which each object stores a count of the references pointing to it.
Each string keeps a reference count so it can be shared safely.
3. A method of tracking shared resources by incrementing and decrementing a counter.
Reference counting lets the file handle be closed when the last user releases it.
4. A memory reclamation strategy that can suffer from cycles.
Two objects pointing at each other can never reach zero with plain reference counting.