Ulrich Norbisrath wrote:
> Why don't the finalizers of an object run, when a garbage-collection
> is performed?

They are run when the RTS recognizes that the object is dead, which
is not necessarily at the first GC after the object is unreachable
(GHC uses a generational garbage collector by default).

> In my case they do only run at the end of my program.

It is only guaranteed that they are *eventually* run.

> If I trigger a gc in hugs the object is garbage collected but not
> finalized.

Which version of GHC/Hugs are you using exactly?

> If I wait for a beep in ghc (via +RTS -B -RTS) the object is not
> collected.

See above.

> In ghc I have to use finalize, but that does not run the finalizer.

If you are talking about Weak.finalize this would indeed be a bug.
Do you have a small example? Are you using weak pointers and/or
foreign objects?

Cheers,
   Sven

P.S.: I've guessed quite heavily above, but I'm sure SimonM will
correct me  if I'm wrong...  :-}
-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.informatik.uni-muenchen.de/~Sven.Panne

Reply via email to