Hi all,
I think this is a bug in ghc 5.03 (whatever is in the CVS).
Please excuse me if I'm wrong.
file: ghc/rts/Stable.c
symptom: seg faults sometimes (tricky to reproduce, but occurs when
you have more than one live stable pointer to the same value,
and a bunch of other live stable pointers around at the same
time). The order that you free and allocate makes a difference
as to whether you see the bug or not.
reason: corruption of the stable pointer table due to the
premature freeing of an entry in the stable pointer
table -- the pointer stable_ptr_free becomes corrupt
and points to something outside the table.
possible fix: Do not call freeStableName on an entry in the
stable pointer table if its reference count is
not zero.
Suggested patch: (bjpop@urania:~/fptools/ghc/rts$ diff -c Stable.c.new Stable.c.old)
--- begin patch ---
*** Stable.c Wed Apr 24 21:52:10 2002
--- /tmp/Stable.c Wed Apr 24 21:40:05 2002
***************
*** 245,251 ****
// If this entry has no StableName attached, then just free it
// immediately. This is important; it might be a while before the
// next major GC which actually collects the entry.
! if (sn->sn_obj == NULL && sn->ref == 0) {
freeStableName(sn);
}
}
--- 245,251 ----
// If this entry has no StableName attached, then just free it
// immediately. This is important; it might be a while before the
// next major GC which actually collects the entry.
! if (sn->sn_obj == NULL) {
freeStableName(sn);
}
}
--- end patch ---
If you want a piece of code that seg-faults I can give it to you.
Currently I have a bit of a mess with C foreign calls and so on which
makes it hard to see what is happening anyway.
Cheers,
Bernie.
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs