Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 Subject: Re: perl - segfault on "free unused scalar" Date: Wed, 27 Jul 2005 18:56:19 +0200 Lines: 44 Message-ID: References: <42E76865 DOT 4000301 AT familiehaase DOT de> <42E7B413 DOT 8040203 AT familiehaase DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) In-Reply-To: <42E7B413.8040203@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 request for 4040 bytes, total sbrk() is >>> 402624512 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? > > I don't know. Maybe it is a Windows feature that applications running > out of memory are crashing? But there's plenty of memory left when perl crashes. I have 1 GB RAM and 1 GB swap file. I've simplified the test case. It seems that Cygwin perl can't handle too much memory. For instance: $ perl -e '$a="a"x(200 * 1024 * 1024); sleep 9' OK, this could have failed because $a might require 200 MB of continuous space. But hashes don't, do they? Then why does the following code fail? $ perl -e '$a="a"x(1024 * 1024);my %b; $b{$_}=$a for(1..400);sleep 9' Or that one? $ perl -e '$a="a"x(50 * 1024 * 1024);$b=$a;$c=$a;$d=$a;$e=$a;sleep 10' On linux there's no such problem - perl can use all available memory. 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/