Closed p5pRT closed 17 years ago
This is a bug report for perl from kcronan@oversee.net\, generated with the help of perlbug 1.35 running under perl v5.8.8.
----------------------------------------------------------------- Hi there\,
I believe I've found some kind of allocator bug. The script:
#!/usr/bin/perl my $foo = ''; vec($foo\, (1\<\<$ARGV[0])-1\, 8)=1;
Works fine for me when run with the parameter 27\, but fails with "Out of memory!" when it is 28--a 256M string\, even though there is plenty of virtual memory.
See also http://www.mail-archive.com/beginners%40perl.org/msg81854.html
I describe there some of the resolutions I attempted\, including compiling with -DNO_FANCY_MALLOC -DPLAIN_MALLOC. But none of them were successful. In the end\, I created an array of several strings of length 2^26. With this approach I was able to allocate\, and address with vec()\, at least 1GB.
Thanks!
Kyle Cronan \kcronan@​oversee\.net \kyle@​pbx\.org
On Sat\, Dec 09\, 2006 at 09:36:49PM -0800\, Kyle Cronan wrote:
#!/usr/bin/perl my $foo = ''; vec($foo\, (1\<\<$ARGV[0])-1\, 8)=1;
Works fine for me when run with the parameter 27\, but fails with "Out of memory!" when it is 28--a 256M string\, even though there is plenty of virtual memory.
Thanks for the report. Present in bleed too.
Perl_do_vecset() and Perl_do_vecget() in doop.c start by calculating the required size of the string in bits\, which overflows if the byte length of the string is 2^31/8.
Presumably the code needs re-engineering to do the calculations in bytes+fractions rather than bits.
Hopefully someone will volunteer....
-- This email is confidential\, and now that you have read it you are legally obliged to shoot yourself. Or shoot a lawyer\, if you prefer. If you have received this email in error\, place it in its original wrapping and return for a full refund. By opening this email\, you accept that Elvis lives.
The RT System itself - Status changed from 'new' to 'open'
On 2006-12-10\, at 20:21:46 +0000\, Dave Mitchell wrote:
On Sat\, Dec 09\, 2006 at 09:36:49PM -0800\, Kyle Cronan wrote:
#!/usr/bin/perl my $foo = ''; vec($foo\, (1\<\<$ARGV[0])-1\, 8)=1;
Works fine for me when run with the parameter 27\, but fails with "Out of memory!" when it is 28--a 256M string\, even though there is plenty of virtual memory.
Thanks for the report. Present in bleed too.
Perl_do_vecset() and Perl_do_vecget() in doop.c start by calculating the required size of the string in bits\, which overflows if the byte length of the string is 2^31/8.
Presumably the code needs re-engineering to do the calculations in bytes+fractions rather than bits.
Something like the attached patch?
Actually\, I think all those I32's should rather be IV's. then building with 64-bit support would (hopefully) automatically solve the problem that blocks larger than 2GB still cannot be handled. But that would involve a bit more changes.
Marcus
On 10/12/06\, Marcus Holland-Moritz \mhx\-perl@​gmx\.net wrote:
Presumably the code needs re-engineering to do the calculations in bytes+fractions rather than bits.
Something like the attached patch?
Thanks\, applied as change #29506.
@rgs - Status changed from 'open' to 'resolved'
Migrated from rt.perl.org#41065 (status was 'resolved')
Searchable as RT41065$