diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2002-11-14 23:03:00 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-11-16 20:25:57 +0000 |
commit | eba0f806800ee6c16a404edf6a6aff3df57bdcb5 (patch) | |
tree | 1926eddd1b45f8af4de747a8bf9b557b6214858e /perl.c | |
parent | 40f1df11ae16783cbf9e21d31dd70ec71d4993dc (diff) | |
download | perl-eba0f806800ee6c16a404edf6a6aff3df57bdcb5.tar.gz |
optional code for debugging leaking scalars
Message-ID: <20021114230300.B18614@fdgroup.com>
p4raw-id: //depot/perl@18150
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -752,6 +752,24 @@ perl_destruct(pTHXx) if (PL_sv_count != 0 && ckWARN_d(WARN_INTERNAL)) Perl_warner(aTHX_ packWARN(WARN_INTERNAL),"Scalars leaked: %ld\n", (long)PL_sv_count); +#ifdef DEBUG_LEAKING_SCALARS + if (PL_sv_count != 0) { + SV* sva; + SV* sv; + register SV* svend; + + for (sva = PL_sv_arenaroot; sva; sva = (SV*)SvANY(sva)) { + svend = &sva[SvREFCNT(sva)]; + for (sv = sva + 1; sv < svend; ++sv) { + if (SvTYPE(sv) != SVTYPEMASK) { + PerlIO_printf(Perl_debug_log, "leaked: 0x%p\n", sv); + } + } + } + } +#endif + + #if defined(PERLIO_LAYERS) /* No more IO - including error messages ! */ PerlIO_cleanup(aTHX); |