[Haskell-cafe] ghci: Difference in garbage collection etc. between REPL and function

Niklas Hambüchen mail at nh2.me
Thu May 9 03:54:59 CEST 2013


I have an annoying bug in a C binding that can be triggered like this:


    handle <- open ...

    prep <- makePreparedStatement handle "INSERT ..."

    performGC

    runStatement prep

    close handle

If I run these steps one by one in ghci, garbage ends up in my handle as
expected.

However, if I "let main = do ..." this whole block in order to pack it
in a test case, it does not happen, neither in ghci nor ghc.

What might be the special magic in ghci's REPL that allows me to trigger
my bug so easily there?

Thanks
Niklas




More information about the Haskell-Cafe mailing list