Question

Valgrind is reporting that my program is performing an invalid read on a memory location that was freed by the garbage collector.

It would be helpful for Valgrind to show the allocation location of the memory that was invalidly read along with the pair:

"Invalid Read of size 2"

and

"Address 0x523befe is 6 bytes inside a block of size 12 free'd"

But alas no memory allocation location is shown. Here's my Valgrind command line:

valgrind --tool=memcheck --leak-check=full --track-origins=yes --undef-value-errors=yes --read-var-info=yes --num-callers=50

I've tried sticking --track-origins=yes right after --tool=memcheck, and a couple other places, to no avail.

Any idea how to get the memory creation location in this instance?

EDIT:

Here's the final Valgrind output:

==14849== LEAK SUMMARY:
==14849== definitely lost: 0 bytes in 0 blocks
==14849== indirectly lost: 0 bytes in 0 blocks
==14849== possibly lost: 900 bytes in 24 blocks
==14849== still reachable: 631,292 bytes in 45,043 blocks
==14849== suppressed: 0 bytes in 0 blocks
==14849== Reachable blocks (those to which a pointer was found) are not shown.
==14849== To see them, rerun with: --leak-check=full --show-reachable=yes
==14849==
==14849== For counts of detected and suppressed errors, rerun with: -v
==14849== ERROR SUMMARY: 14 errors from 14 contexts (suppressed: 0 from 0)

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top