Reference counting is a mechanism whereby a count is maintained
for every reference to an object. When an object's reference count
reaches zero, there are no references to it, so the object can be
safely destroyed. References include pointers. They are used to
ensure an object remains in scope for as long as there's at least
one reference, and are used extensively in most garbage collection
systems, which periodically destroys all objects that are no longer
referenced.
High-level languages such as VB and Delphi have built-in support
for reference counting, but C/C++ does not. The onus is therefore
on the programmer to make consistent use of "smart" pointers, which
simulate standard pointers but include additional information to
aid with reference counts, memory management/ownership, and bounds
checking.
When programming for a mixed-language environment, such as COM
(component object model), where the individual components may be
constructed from several sources written in different languages,
and shared between different programs, maintaining accurate
reference counts and reference ownership is essential to ensure no
memory leaks occur. Microsoft have largely replaced COM with the
.NET paradigm, so C#, F# and VB objects can safely co-exist, with
automatic garbage collection, but the onus is still upon the C++
programmer to specifically code for the framework.