Reference counting

Reference counting is a method of garbage collection that works by keeping a reference count in each object, tracking the number of referrers to that particular object. Trivially, when there are zero referrers left, the object may be garbage collected. Reference counting is simple to implement but has the intrinsic weakness that cyclic data structures, where several objects have mutual references, can never be garbage collected.

See also Tracing garbage collection.

Get Oracle JRockit now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.