Hi, I was wondering if anyone can help me figure out a problem having to do with accessing a scalar variable with vec().. it's illustrated by this little test program:
#!/usr/bin/perl my $foo = ''; vec($foo, (1<<$ARGV[0])-1, 8)=1; I can run this with the argument 27, and it works just fine. Perl uses a bit more than 128 MB virtual memory before exiting, just as one would expect. When I run the program with n=28 (perl 5.8.8, linux), I get: Out of memory! I have plenty of virtual memory, so there's no reason a malloc would fail that I can think of. From looking at perldebguts and malloc.c in the source, it looks like sbrk is also used (is this just for package globals?), so I tried using a lexical variable and I tried getting a reference to an anonymous scalar with $vec = *foo{SCALAR} then extending $$vec, but the same thing happened. I can create a string of the same size using something like 'chr(0) x (1<<$ARGV[0])', and perl will happily create a character array of length 2^28 (and use half a gig to do so of course ;). But even if I extend the scalar to the correct length in this fashion, I still get fatal errors when trying to write into it with vec(). Then I thought maybe there's something like a maximum bucket size in the perl allocator, which vec() lvalues don't handle properly, so I tried compiling perl with -DNO_FANCY_MALLOC and -DPLAIN_MALLOC. I still get the same error. I don't understand why a 128 MB scalar string is no problem but 256 MB causes this? I've noticed that with perl 5.8.6 I get the error "panic: realloc at ...". Perhaps it's the same error condition described more accurately? But according to perldiag, this is an internal error that indicates something tried to allocate a negative number of bytes! Should I submit this with perlbug? Thanks, Kyle Cronan <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>