SvREFCNT#
Return the reference count of a referent. SvREFCNT(\$x) answers “how many live references to $x exist right now?” — the usual tool for tracking a suspected leak without pulling the number out of a full Dump.
The argument must be a reference (prototype \[$@%&*]). The
referent’s refcount is returned, minus one so that the temporary
reference created by the \ operator does not skew the answer.
Passing anything that is not a reference croaks with
Usage: Devel::Peek::SvREFCNT(SCALAR).
Typical pattern: snapshot the count before and after a suspected leak site and look for growth that does not drop back.