delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/27/09:42:54

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: Re: perl - segfault on "free unused scalar"
Date: Wed, 27 Jul 2005 15:40:42 +0200
Lines: 57
Message-ID: <dc82t0$r0a$1@sea.gmane.org>
References: <dc7n8k$m72$1 AT sea DOT gmane DOT org> <42E76865 DOT 4000301 AT familiehaase DOT de>
Mime-Version: 1.0
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
In-Reply-To: <42E76865.4000301@familiehaase.de>
X-IsSubscribed: yes

Gerrit P. Haase wrote:

>> $ ./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)
> 
> With 5.8.7 I get the core dump after calling `foo 1` the first time:
> 
> $ ./inter.pl
> perl> sub foo($){$a=shift;foo($a+1);}
> perl> foo 1
> Out of memory during request for 4040 bytes, total sbrk() is 402624512 
> bytes!
> Segmentation fault (core dumped)

How many times did you try that? With 5.8.7 I get either

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

or, like you

perl> sub foo($){$a=shift;foo($a+1);}
perl> foo 1
Out of memory during request for 4040 bytes, total sbrk() is 402620416 bytes!
Segmentation fault (core dumped)


Another version (with "my $a"):

perl> sub foo($){my $a=shift;foo($a+1);}
perl> foo 1
Out of memory during "large" request for 134221824 bytes, total sbrk() is 
304633856 bytes at (eval 19) line 1.
perl> foo 1
Bad realloc() ignored at (eval 19) line 1.
Segmentation fault (core dumped)


Is this a perl bug, Cygwin bug, or just a feature?

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