This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv_vcatpvfn hogs memory [Patch included]
authorMatthias Neeracher <neeri@iis.ee.ethz.ch>
Sat, 21 Jun 1997 04:38:35 +0000 (16:38 +1200)
committerTim Bunce <Tim.Bunce@ig.co.uk>
Wed, 6 Aug 1997 12:00:00 +0000 (00:00 +1200)
commit7bc39d6220d2b77d9c5827625d97cd2af6ef9c56
treea084ff3907611e099e6475fbb3cbe9d65f03e242
parent57569e04d232667a3e52996dff0f1e57f7d36b43
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
sv.c