summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-12-06 15:01:14 -0700
committerKarl Williamson <khw@cpan.org>2020-12-19 22:00:30 -0700
commit03694582f8c247d4a1cc8a7bb8348af0173944d7 (patch)
tree663345306aa5475ca4758b0db7a5f026c410c865 /sv.c
parent35bcf7ffa2bfeab79ab7b4eb0d35f462775b54d2 (diff)
downloadperl-03694582f8c247d4a1cc8a7bb8348af0173944d7.tar.gz
Fix broken PERL_MEM_LOG under threads
This fixes GH #18341 There are problems with getenv() on threaded perls wchich can lead to incorrect results when compiled with PERL_MEM_LOG. Commit 0b83dfe6dd9b0bda197566adec923f16b9a693cd fixed this for some platforms, but as Tony Cook, pointed out there may be standards-compliant platforms that that didn't fix. The detailed comments outline the issues and (complicated) full solution.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index 18d9e0436b..d4df78fb02 100644
--- a/sv.c
+++ b/sv.c
@@ -15407,6 +15407,10 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
/* op_free() hook */
PL_opfreehook = proto_perl->Iopfreehook;
+# ifdef PERL_MEM_LOG
+ Zero(PL_mem_log, sizeof(PL_mem_log), char);
+# endif
+
#ifdef USE_REENTRANT_API
/* XXX: things like -Dm will segfault here in perlio, but doing
* PERL_SET_CONTEXT(proto_perl);