Perl linked list segfault

Matthew Boyle mlb-perl at decisionsoft.co.uk
Wed Nov 4 10:45:13 GMT 2009


Dirk Koopman wrote:
> Andy Wardley wrote:
>> On 04/11/2009 07:55, Andy Wardley wrote:
>>> I've got some code that's making Perl segfault.
>>
>> Here's the complete script in case anyone wants to play along at
>> home:
>>
>>    http://wardley.org/perl/linked_list_segfault.pl
> 
> shifting out all the @tokens works; undefing or emptying @tokens segfaults.
> 
> Is this an ordering thing?

mine seems to be running out of stack space:

[chemnitz at 10:36 ~]$ gdb perl
GNU gdb Fedora (6.8-32.fc10)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(no debugging symbols found)
Missing separate debuginfos, use: debuginfo-install perl-5.10.0-73.fc10.i386
(gdb) run downloads/linked_list_segfault.pl
Starting program: /usr/bin/perl downloads/linked_list_segfault.pl

[snip]

starting
creating linked list of 40000 tokens
created 40000 tokens
creating linked list of 40000 tokens in container
created 40000 tokens
[New Thread 0xb7fe26c0 (LWP 9178)]

Program received signal SIGSEGV, Segmentation fault.
0x026e6105 in Perl_sv_free2 () from 
/usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/libperl.so
(gdb) bt -1
#229310 0x08048a2e in main ()
(gdb)

quarter of a million frames is quite a lot :-)

--matt


-- 
Matthew Boyle, Systems Administrator, CoreFiling Limited
Telephone: +44-1865-203192  Website: http://www.corefiling.com


More information about the london.pm mailing list