summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-11-20 20:39:56 -0800
committerFather Chrysostomos <sprout@cpan.org>2013-11-22 21:20:37 -0800
commit865e3ae09bd2dde9953a008963d3c5a0ad14e32d (patch)
tree561da0ed53edbfa8fa507bff4ae30331115ad08e /av.c
parent0ff725582ada84044c87936ed5498addbfbb2a5a (diff)
downloadperl-865e3ae09bd2dde9953a008963d3c5a0ad14e32d.tar.gz
Extend STRESS_REALLOC to move the stack with every EXTEND
This allows us easily to catch cases where the stack could move to a new memory address while code still holds pointers to the old loca- tion. Indeed, this causes test failures.
Diffstat (limited to 'av.c')
-rw-r--r--av.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/av.c b/av.c
index bae7e61487..d5dda54ca0 100644
--- a/av.c
+++ b/av.c
@@ -143,7 +143,16 @@ Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp,
#endif
MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend);
}
+#ifdef STRESS_REALLOC
+ {
+ SV ** const old_alloc = *allocp;
+ Newx(*allocp, newmax+1, SV*);
+ Copy(old_alloc, *allocp, *maxp + 1, SV*);
+ Safefree(old_alloc);
+ }
+#else
Renew(*allocp,newmax+1, SV*);
+#endif
#ifdef Perl_safesysmalloc_size
resized:
#endif