Ticket #1723 (closed bug: fixed)
[bug] linked lists result in segfaults
Reported by: | pmichaud | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GC | Version: | 2.6.0 |
Severity: | medium | Keywords: | |
Cc: | Language: | ||
Patch status: | Platform: |
Description
Creating a linked list of moderate size ultimately leads to a segfault during GC.
The following program simply creates a linked list of nodes. On my system, I get a segfault after about 96K nodes:
pmichaud@plum:~/parrot/trunk$ cat list2.pir .sub 'main' :main .local pmc iterclass, intclass iterclass = newclass ['RangeIter'] addattribute iterclass, '$!value' addattribute iterclass, '$!nextIter' intclass = subclass ['Integer'], 'Int' .local pmc head, next head = new iterclass $P0 = new intclass setattribute head, '$!value', $P0 next = head loop: ($I0, next) = next.'reify'() $I1 = $I0 % 5000 if $I1 goto loop say $I0 goto loop .end .namespace ['RangeIter'] .sub 'reify' :method .local pmc value, nextiter value = getattribute self, '$!value' nextiter = new ['RangeIter'] setattribute self, '$!nextIter', nextiter $P0 = add value, 1.0 setattribute nextiter, '$!value', $P0 .return ($P0, nextiter) .end pmichaud@plum:~/parrot/trunk$ ./parrot list2.pir 5000 10000 15000 20000 25000 30000 35000 40000 45000 50000 55000 60000 65000 70000 75000 80000 85000 90000 95000 Segmentation fault pmichaud@plum:~/parrot/trunk$
gdb shows that the segfault occurs in gc mark:
Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7a5d7e5 in Parrot_gc_mark_PMC_alive_fun (interp=0x60a080, obj=0x3418e80) at src/gc/api.c:166
Some Rakudo users have reported segfaults on lists with less than 10,000 nodes.
Pm
Change History
Note: See
TracTickets for help on using
tickets.