On 13/12/2018 01:07, Chris Teague wrote:

> 4. Clear out the threads stack via memset() to ensure I don't leave any
> interesting data in the heap.

If I had to guess, I'd say it was this.  When the stack pointer moves up
(to deallocate stuff stored on the stack), Memcheck marks the just-freed
area as no-access, so it can detect mistaken attempts to access there
later.  So I imagine it has done this with your stack too.  Result is that
when you memset-zero your stack, you got the complaint you got.

If you really want to do that, you can #include <valgrind/memcheck.h> and
then use VALGRIND_MAKE_MEMORY_UNDEFINED(stack, length of stack) so as to
mark it accessible but containing garbage, before you zero it out.

J


_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to