summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorMatthias Neeracher <neeri@iis.ee.ethz.ch>1997-06-21 16:38:35 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-08-07 00:00:00 +1200
commit7bc39d6220d2b77d9c5827625d97cd2af6ef9c56 (patch)
treea084ff3907611e099e6475fbb3cbe9d65f03e242 /sv.c
parent57569e04d232667a3e52996dff0f1e57f7d36b43 (diff)
downloadperl-7bc39d6220d2b77d9c5827625d97cd2af6ef9c56.tar.gz
sv_vcatpvfn hogs memory [Patch included]
This is a bug report for perl from neeri@iis.ee.ethz.ch For each %x element to be inserted, sv_vcatpvfn grows the sv to SvLEN + the size of the element. I strongly suspect that this is a typo, as this totally defeats the purpose of the sv_grow buffering and leads to huge sv's with most memory unallocated. I have included a patch that I believe to be correct; I am not 100% sure whether the "+1" is needed, too, but I suspect that it is. As an aside, from my past two bug reports, I'm starting to believe that it might be worthwhile to add monitoring of memory consumption to the execution of the perl test suite: I noticed the bug when the execution of the seemingly innocuous comp/colon.t failed with an out of memory error attempting to allocate a huge (>10M) sv. I assume that the execution of comp/colon.t on an UNIX system would consume just as much memory, but is not usually noticed because a VM system can easily absorb this. Adding memory consumption figures to the test reports, if this is possible to do in a portable way, might uncover more bugs like this. p5p-msgid: 199706211521.RAA12778@solar.ethz.ch
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index ce85a4bb89..1d50cf8349 100644
--- a/sv.c
+++ b/sv.c
@@ -4630,7 +4630,7 @@ sv_vcatpvfn(sv, pat, patlen, args, svargs, svmax, used_locale)
need = (have > width ? have : width);
gap = need - have;
- SvGROW(sv, SvLEN(sv) + need);
+ SvGROW(sv, SvCUR(sv) + need + 1);
p = SvEND(sv);
if (esignlen && fill == '0') {
for (i = 0; i < esignlen; i++)