This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
SV_CONST(name) and PL_sv_consts
[perl5.git] / perl.c
diff --git a/perl.c b/perl.c
index 41b0a64..90b5695 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -308,6 +308,8 @@ perl_construct(pTHXx)
     HvSHAREKEYS_off(PL_strtab);                        /* mandatory */
     hv_ksplit(PL_strtab, 512);
 
+    Zero(PL_sv_consts, SV_CONSTS_COUNT, SV*);
+
 #if defined(__DYNAMIC__) && (defined(NeXT) || defined(__NeXT__))
     _dyld_lookup_and_bind
        ("__environ", (unsigned long *) &environ_pointer, NULL);
@@ -1081,6 +1083,12 @@ perl_destruct(pTHXx)
     sys_intern_clear();
 #endif
 
+    /* constant strings */
+    for (i = 0; i < SV_CONSTS_COUNT; i++) {
+        SvREFCNT_dec(PL_sv_consts[i]);
+        PL_sv_consts[i] = NULL;
+    }
+
     /* Destruct the global string table. */
     {
        /* Yell and reset the HeVAL() slots that are still holding refcounts,