[Haskell-cafe] Re: libefence useful for debugging ghc+ffi programs?

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Wed Oct 20 18:44:35 EDT 2010

OK, never mind, I found the problem in my C code.

some uninitialized variables - mostly they were 0, 
but sometimes not: I guess when I got  mallocForeignPtrBytes
that were just freed by the garbage collector.

Although the program does a ton of allocations, 
most start with memcpy of something that the program computed earlier,
expect for a handfull of root nodes.
But these were allocated early, when there was little garbage,
so I got most of them in their zeroed-out initial state,
and that's why the error did not show. (At least that's my guess.)

This restores my faith in ghc, ffi, and library writers -

and shows how much I unlearned C programming
(which I guess is generally a good thing - except when you program C).


More information about the Haskell-Cafe mailing list