delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/27/06:23:58

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: Krzysztof Duleba <krzysan AT skrzynka DOT pl>
Subject: perl - segfault on "free unused scalar"
Date: Wed, 27 Jul 2005 12:22:06 +0200
Lines: 75
Message-ID: <dc7n8k$m72$1@sea.gmane.org>
Mime-Version: 1.0
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-IsSubscribed: yes

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019