Re: valgrind: Heap block lo/hi size mismatch when trying to debug a C++ program running inside Docker container

John Reiser <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
On 11/13/19 at 04:18 UTC, Karthik Jayaraman wrote:
> When trying to debug my C++ binary, I am running into the following issue.
> 
> valgrind: m_mallocfree.c:307 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
> 
> valgrind
> : Heap block lo/hi size mismatch: lo = 1, hi = 4294967295.
> This
>   is probably caused by your program erroneously writing past the
> end of a heap block and corrupting heap metadata
> .  If
>   you fix any
> invalid writes reported by
> Memcheck, this
>   assertion failure will
> probably go away
> .  Please try that before reporting this as a bug.
    <<snip>>


Which version of valgrind?  (Run "valgrind --version".)
Which hardware, operating system, and version?
Which C++ compiler and version?

Did memcheck report any invalid writes?  Did you fix them?


> But the interesting fact is, it works wonderfully well when same binary is running outside the container (on a VM). If my source binary has a memory link (as per Valgrind FAQs) I am puzzled as to why I am not encountering the issue when not running in a container.

If the operating system that runs inside the container does not layout
the address space of valgrind identically to the address space of valgrind
as laid out by the VM outside the container, then the results can differ.
(There might be a bug in memcheck, too.)

Re-run with "valgrind -v -v -v -d -d -d <<original arguments>>"
to get more information.  Copy+paste that info into an attachment
of a bug report; see the Bug Reports link on the page  http://valgrind.org .
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.