summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2002-11-14 23:03:00 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-11-16 20:25:57 +0000
commiteba0f806800ee6c16a404edf6a6aff3df57bdcb5 (patch)
tree1926eddd1b45f8af4de747a8bf9b557b6214858e /perl.c
parent40f1df11ae16783cbf9e21d31dd70ec71d4993dc (diff)
downloadperl-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.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index a2aa4d2b92..11da3153c5 100644
--- a/perl.c
+++ b/perl.c
@@ -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);