The Revenge of Finalizers
Alastair Reid
alastair at reid-consulting-uk.ltd.uk
Fri Oct 18 11:02:04 EDT 2002
SimonM:
> I can get it to fail another way too:
> main = do
> p <- mallocBytes 64
> newForeignPtr p (print x)
> print x
> where
> x = sum [1..10000]
The problem is probably this shared mutable variable used behind the
scenes in the implementation of the numeric show code (hugs98/src/printer.c)
static Cell out; /* GC'd var used by printer code */
[It's also used if you use the -u flag to use Hugs' builtin printer
instead of the Show function - but I don't think anyone does that
anymore and we could probably kill that code without anyone noticing
(???). (Unless, does Hood or some such use it?)]
I think all the functions affected return void so it'd be easy to
replace the global variable with a local which is threaded through
that set of functions.
--
Alastair
More information about the FFI
mailing list