[mercury-users] Ever valground a mercury program?
Nicholas Nethercote
njn at csse.unimelb.edu.au
Wed May 23 16:31:15 AEST 2007
On Wed, 23 May 2007, Ondrej Bojar wrote:
> My rotd-2007-03-07 generates executables that make valgrind shout and shout
> and shout. In fact, the main(io,io) does not start in valgrind at all and the
> detstack overflows instead.
>
> Have any of you ever used valgrind on Mercury programs? Are there any special
> caveats?
Mercury's garbage collector does lots of low-level nasty stuff that violate
Valgrind's assumptions about memory behaviour. For example, if a program
wants to know if a page is addressable, it could set up a SIGSEGV/SIGBUS
signal handler and write to it -- it it faults, then the page is not
addressable. But Valgrind assumes that programs won't do this kind of
thing.
Also, because the GC is conservative it may look for pointers in memory that
is uninitialised, which is reasonable in this case but again violates
Valgrind's assumptions. I'm guessing that's what the messages you got
related to.
Unless there's a way to disable the garbage collector in Mercury, I don't
think you'll have much luck using Valgrind with it. Can you test the C code
in a harness without hooking it up to Mercury?
The stack issue could be because Valgrind limits the stack to 8MB, if I
recall correctly.
Nick
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list