Search code examples
valgrind

Valgrind memcheck keeps dying before it finishes


When running valgrind memcheck, it keeps dying and killing the process with output like the following:

valgrind: m_oset.c:156 (elem_of_node): Assertion 'n->magic == OSET_MAGIC' failed.
valgrind: bad magic on node 0x1574B69EE0 = ffffdddd (expected 5b1f)
possible causes:
 - node metadata corrupted by overwriting end of element?

I am interpreting this as valgrind stopping because one of its internal data structures appears to be corrupted due to a failed assertion. I don't understand why this would happen, though. It seems to be somewhat repeatable in my environment. The exact node address differs each run, but it is always approximately around the same address (another run showed 0x1573C405E0). Is this indicative of bad RAM, some memory corruption bug in my software, a bug in valgrind, or something else?

In case it is helpful, I am running the following:

valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --show-leak-kinds=all --leak-resolution=med --track-origins=yes --vgdb=no [my_application]

I've used valgrind memcheck in the past without running into issues like this, and I'm not sure what is happening here.


Solution

  • Per the 5th comment from my original question, this appears to be related to the valgrind macros and can at least be worked around by spacing out the macro calls to give more processing time prior to the crash. Moving to a newer version might help, too, but is unknown and not an option for me at this time.