Didn't ghc 4.08-1 just come out in the last couple of months or so? Maybe there have been some bug fixes that deal with this. Of course, maybe not. cheers, Micha On Wed, 17 Jan 2001 03:08:48 -0800 simonmar@microsoft.com wrote:
I would like to run some code when something is garbage-collected. Fine, he says, just the job for finalizers (module Weak). Unfortunately, they don't seem to offer a general solution, as the code below demonstrates (presumably, smallish things are copied, not shared, so that the finalizers run too early?).
Yes, small Ints (approximately 30 bits worth) and Chars have a special representation which makes it impossible to tell if they have been GC'd
GHC has a similar problem for Chars and small ints (-15..15 I think).
GHC has similar problems for just about all types, due to agressive inlining and other optimisations. We've found that the only reliable types on which you can set a finalizer are the primitive heap-resident ones, like ForeignObj# and MutVar#. That's why using addForeignFinalizer is better than using the generic addFinalizer.
We dreamed up various hacks to subvert the optimisations, but haven't found any clean solutions yet. The problem is one of "identity": how to give an object a name such that you can refer to that particular object.
Cheers, Simon
_______________________________________________ Hugs-Users mailing list Hugs-Users@haskell.org http://www.haskell.org/mailman/listinfo/hugs-users
Didn't ghc 4.08-1 just come out in the last couple of months or so? Maybe there have been some bug fixes that deal with this. Of course, maybe not.
I think Simon Marlow is very well placed to be able to comment on whether GHC has the problems Claus reported and whether they're just minor bugs or (and this is how I read his email) fundamental to the way GHC is implemented. (See the hall of fame in the GHC web pages for reasons to believe this but don't believe the photo on his home page - he doesn't look so glaikit in person.) -- Alastair Reid ps ghc 4.08-1 has a major bug in the finalizers which makes it unusable for people who need finalizers, the foreign function interface, etc. (There is a fix in the CVS repository but you have to build GHC yourself from source to be able to use it.)
Well that bites doesn't it? cheers, Micha On Wed, 17 Jan 2001, Alastair Reid wrote:
Didn't ghc 4.08-1 just come out in the last couple of months or so? Maybe there have been some bug fixes that deal with this. Of course, maybe not.
I think Simon Marlow is very well placed to be able to comment on whether GHC has the problems Claus reported and whether they're just minor bugs or (and this is how I read his email) fundamental to the way GHC is implemented. (See the hall of fame in the GHC web pages for reasons to believe this but don't believe the photo on his home page - he doesn't look so glaikit in person.)
-- Alastair Reid
ps ghc 4.08-1 has a major bug in the finalizers which makes it unusable for people who need finalizers, the foreign function interface, etc. (There is a fix in the CVS repository but you have to build GHC yourself from source to be able to use it.)
_______________________________________________ Hugs-Users mailing list Hugs-Users@haskell.org http://www.haskell.org/mailman/listinfo/hugs-users
participants (3)
-
Alastair Reid -
Micha Julian Pringle -
mpringle@sfu.ca