[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segfault in scheme code
From: |
Ludovic Courtès |
Subject: |
Re: Segfault in scheme code |
Date: |
Thu, 16 Aug 2007 12:59:44 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) |
Hi,
Jon Wilson <address@hidden> writes:
> I'm running guile-1.8.2 on ubuntu feisty. The following function
> causes guile to segfault:
>
> guile> (define (consing lst) (consing (cons lst lst)))
> guile> (consing '())
> Segmentation fault (core dumped)
>
> I understand that guile should never ever segfault from plain scheme code.
Right, but you're nastily provoking it. ;-)
We don't hit an out-of-memory situation here, but rather a stack
overflow while marking:
#0 0xb7ed15d8 in scm_gc_mark_dependencies (p=0xb7b0f5e8) at
../../libguile/gc-mark.c:218
#1 0xb7ed16cc in scm_gc_mark (ptr=0xb7b0f5e8) at ../../libguile/gc-mark.c:169
#2 0xb7ed15dd in scm_gc_mark_dependencies (p=0xb7b0f5a0) at
../../libguile/gc-mark.c:218
#3 0xb7ed16cc in scm_gc_mark (ptr=0xb7b0f5a0) at ../../libguile/gc-mark.c:169
The thing here is that the GC is essentially traversing a tree in a
non-tail-recursive fashion.
FWIW, the `libgc'-based Guile doesn't have this problem, it just keeps
consing.
Thanks,
Ludovic.