This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

perl - segfault on "free unused scalar"


While playing with perl in interactive mode, I experienced strange memory error in Cygwin perl. Trying the same scenario on Linux boxes results in perl being killed after using all memory (tested on machines with 128 - 2048 MB RAM), but on Cygwin perl dies in a different way.

The following script was executed to run perl in interactive mode:

$ cat inter.pl
#!/usr/bin/perl

use Term::ReadLine;
use IO::Handle;

my $prompt = "perl> ";

my $term = new Term::ReadLine $prompt;
my $OUT = $term->OUT;

while ( defined($_ = $term->readline($prompt)) ) {
        next unless /\S/;
        eval $_;
        chomp $@;
        printf "%s\n", $@ if $@;
}

Now how perl died:

$ ./inter.pl
perl> sub foo($){$a=shift;foo($a+1);}
perl> foo 1
Out of memory during "large" request for 134221824 bytes, total sbrk() is 273211392 bytes at (eval 18) line 1.
perl> foo 1
Out of memory during request for 67289644 bytes, total sbrk() is 394086400 bytes
!
Attempt to free unreferenced scalar: SV 0x1d079aec, Perl interpreter: 0x10140240 at (eval 18) line 1.
Segmentation fault (core dumped)


$ cat perl.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=100B1A4C
eax=27857BF4 ebx=000E209C ecx=27858520 edx=1D079AF8 esi=1C257F08 edi=10140240
ebp=0022E958 esp=0022E930 program=d:\cygwin\bin\perl.exe, pid 2392, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
0022E958  100B1A4C  (10140240, 00000000, 10114A3F, 00000008)
0022E978  10002D33  (0022EA86, 10114A3F, 0022EAA8, 10009F0B)
0022E988  10002E90  (10140240, 00000001, 10114B2C, 00000001)
0022EAA8  10009F0B  (0402C22C, 00000000, 00000000, 27857BF4)
0022EAE8  1006EDD5  (10140240, 27857BF4, 0100B488, 00000010)
0022EB18  100B1A3B  (10140240, 00000002, 10164B50, 0000006F)
0022EB58  100B1EF7  (10140240, 10164B50, 0000006F, 6104B6DE)
0022EB88  10060832  (10140240, 10114A78, 0022EBA4, 00000003)
0022EBA8  10060A1F  (10114A78, 08001000, 00000000, 177D4800)
0022ECC8  1000A277  (07F25728, 00000000, 0022ECF8, 00000000)
0022ED08  1000A6BF  (17BB6008, 07F26720, 0022ED38, 00000000)
0022ED38  100ACB62  (10140240, 102ED060, 00000004, 00000001)
0022EDA8  100799E9  (10140240, 10140240, 0022EED8, 100076F5)
0022EDB8  10071E19  (10140240, 00000000, 0022EEB8, 00000001)
0022EED8  100076F5  (10140240, 00401220, 00000002, 61153D1C)
0022EF18  004011D6  (00000002, 61153D1C, 10140090, 7C919AF0)
End of stack trace (more stack frames may be present)

$ uname -a
CYGWIN_NT-5.1 duli5 1.5.19s(0.134/4/2) 20050716 20:51:44 i686 unknown unknown Cygwin


$ perl --version

This is perl, v5.8.6 built for cygwin-thread-multi-64int
[...]

Krzysztof Duleba


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]