Perl statically allocates three SVs: &PL_sv_undef (an undefined value), &PL_sv_yes (a true value) and &PL_sv_no (a false value). Being statically allocated, they cannot be freed. Perl calls them "immortal".
In order to prevent them from getting freed, the functions that get called to free scalars have special checks that prevent them from freeing immortal scalars.
In order to avoid trying to free immortal scalars in the first place, their ref count is initially set very high, and their ref count is reset to that value ((~(U32)0)/2) should it ever reach zero.
These SVs are used in a many places (e.g. &PL_sv_undef). Only allocating them once saves time.
$ perl -E'say Internals::SvREFCNT($$_) for \undef, \!0, \!1;' 2147483625 2147483644 2147483647
In reply to Re: Dumping undef as a constant produces strange REFCNT
by ikegami
in thread Dumping undef as a constant produces strange REFCNT
by Kc12349
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |