Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Perl currently uses a reference-counting approach to memory management. Each time an object acquires a name or a new reference, Perl increments that object’s reference count. Whenever an object loses a name or a reference, Perl decrements its reference count. Once an object’s reference count reaches zero, Perl deletes the object and reclaims the storage used by it.
Reference counting fails when objects point to one another in a circular or self-referential fashion. Consider the following example: