
For debugging, this sounds like overkill to me. Can't you write
bounds-checking versions of your primitives that are turned on with
some CPP? Data.HashMap.Array does this sort of thing, although I don't
think it checks everything it really should. In the back of my mind,
I've been thinking it would be really nice to be able to tell GHC to
use checked versions of its primops. That's seems a bit tricky, since
the SomeException type is at a much higher level, but maybe there's
some way to make it work.
On Thu, Apr 26, 2018 at 2:50 AM, Henning Thielemann
I like to test whether some low-level routines overwrite non-allocated memory area. On the Amiga there was the program Mungwall that surrounded memory blocks with some byte patterns at allocation and checked the integrity of those patterns at deallocation. This would also be possible in Haskell with a modified mallocForeignPtrArray. Has someone already implemented this idea? If yes, how could I easily switch between the mallocForeignPtrArray version with such debugging support and the plain function? It would be unfeasible to re-compile a lot of packages only for debugging. Ideally the test-suite of a package would use the debugging version of mallocForeignPtrArray and the library part would use plain allocation.
I thought about using valgrind but I remember this often gave many false positive bug reports for Haskell programs. _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.