From owner-freebsd-sparc64@FreeBSD.ORG Wed Jul 30 04:02:55 2003 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 445D437B401 for ; Wed, 30 Jul 2003 04:02:55 -0700 (PDT) Received: from tts.orel.ru (tts.orel.ru [213.59.64.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0770643FA3 for ; Wed, 30 Jul 2003 04:02:53 -0700 (PDT) (envelope-from bel@orel.ru) Received: from orel.ru (lg.orel.ru [195.90.189.89]) by tts.orel.ru (8.12.6/8.12.6/bel) with ESMTP id h6UB2n0A014212 for ; Wed, 30 Jul 2003 15:02:50 +0400 Message-ID: <3F27A5DB.2050601@orel.ru> Date: Wed, 30 Jul 2003 15:02:51 +0400 From: Andrew Belashov Organization: ORIS User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3) Gecko/20030411 X-Accept-Language: ru, en-us, en MIME-Version: 1.0 To: freebsd-sparc64@freebsd.org References: <3F210BF6.6070001@orel.ru> <20030725153258.GE10708@funkthat.com> In-Reply-To: <20030725153258.GE10708@funkthat.com> Content-Type: multipart/mixed; boundary="------------050209060502070001000100" Subject: fork&Perl BUG X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jul 2003 11:02:55 -0000 This is a multi-part message in MIME format. --------------050209060502070001000100 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit John-Mark Gurney wrote: > Andrew Belashov wrote this message on Fri, Jul 25, 2003 at 14:52 +0400: > >>My script working perfectly on FreeBSD 4.7R i386. > > > Does it work perfectly on 5.1-R? Yes, it work right on FreeBSD 5.1-R/i386. I'm still work above this problem. My new script crashing Perl@sparc64 depending on memory usege. Good example: -------------------------------------------------------------- bel@trash$ perl perlbug.pl 40000 ........................................ Main: sum = 19904.3003875081, cnt = 40000 Child sleeping... Child pid = 89373 Parent working... Parent: sum = 19904.3003875081, cnt = 40000 Parent waiting a child... Child working... Child: sum = 19904.3003875081, cnt = 40000 Child exiting... Parent exiting... -------------------------------------------------------------- Bad example: -------------------------------------------------------------- bel@trash$ perl perlbug.pl 80000 ................................................................................ Main: sum = 39912.0714518987, cnt = 80000 Child pid = 89383 Parent working... perl in realloc(): warning: modified (chunk-) pointer Out of memory! Attempt to free unreferenced scalar at perlbug.pl line 13. perl in free(): warning: modified (chunk-) pointer Parent: sum = 39912.0714518987, cnt = 80000 Parent waiting a child... Parent exiting... -------------------------------------------------------------- Any ideas? How to localize problem? --------------050209060502070001000100 Content-Type: text/plain; name="perlbug.pl" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="perlbug.pl" #!/usr/bin/perl -w use IO::Handle; my %arr; my @tmpl = ('.', '/', '0'..'9', 'a'..'z', 'A'..'Z'); my $lentmpl = @tmpl; sub docheck { my $prefix = shift; my $sum = 0; my $cnt = 0; foreach my $key (keys(%arr)) { $sum += $arr{$key}; $cnt++; } print "$prefix: sum = $sum, cnt = $cnt\n"; } my $maxsize = shift; STDOUT->autoflush(1); STDIN->autoflush(1); STDERR->autoflush(1); for (my $i = 0; $i < $maxsize; $i++) { my $key = ''; foreach my $j (0..7) { $key .= $tmpl[rand($lentmpl)]; } $arr{$key} = rand; print "." if (($i % 1000) == 0); } print "\n"; &docheck('Main'); die "fork()" unless defined(my $pid = fork()); if ($pid) { print "Child pid = $pid\n"; print "Parent working...\n"; &docheck('Parent'); print "Parent waiting a child...\n"; wait(); print "Parent exiting...\n"; exit(0); } else { print "Child sleeping...\n"; sleep(30); print "Child working...\n"; &docheck('Child'); print "Child exiting...\n"; exit(0); } --------------050209060502070001000100--