summaryrefslogtreecommitdiff
path: root/sv.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 /sv.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 'sv.c')
-rw-r--r--sv.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index a6749866ab..cba547c3da 100644
--- a/sv.c
+++ b/sv.c
@@ -164,7 +164,28 @@ Public API:
/* new_SV(): return a new, empty SV head */
-#define new_SV(p) \
+#ifdef DEBUG_LEAKING_SCALARS
+/* provide a real function for a debugger to play with */
+STATIC SV*
+S_new_SV(pTHX)
+{
+ SV* sv;
+
+ LOCK_SV_MUTEX;
+ if (PL_sv_root)
+ uproot_SV(sv);
+ else
+ sv = more_sv();
+ UNLOCK_SV_MUTEX;
+ SvANY(sv) = 0;
+ SvREFCNT(sv) = 1;
+ SvFLAGS(sv) = 0;
+ return sv;
+}
+# define new_SV(p) (p)=S_new_SV(aTHX)
+
+#else
+# define new_SV(p) \
STMT_START { \
LOCK_SV_MUTEX; \
if (PL_sv_root) \
@@ -176,6 +197,7 @@ Public API:
SvREFCNT(p) = 1; \
SvFLAGS(p) = 0; \
} STMT_END
+#endif
/* del_SV(): return an empty SV head to the free list */