|
From: Philippe W. <phi...@sk...> - 2014-01-14 16:35:30
|
On Tue, 2014-01-14 at 17:04 +0100, David Faure wrote:
> On Tuesday 14 January 2014 08:03:14 Samuel Quiring wrote:
> > Greetings,
> >
> > I suspect my program is corrupting (overwriting) memory, e.g., malloc'ing 16
> > bytes for a string that is 17 bytes when you count the nul, then copying 17
> > bytes into the 16 byte area. What are the best valgrind options for
> > detecting memory corruption?
>
> The default options :-)
>
> (memcheck tool)
>
memcheck default options are effectively ok by default.
But there are some options that you can change if you want to increase
the probability to find a memory corruption or get more info about
such a bug.
Typically, you might use one or more of the following:
--redzone-size=<number> set minimum size of redzones added before/after
heap blocks (in bytes). [16]
--read-var-info=yes|no read debug info on stack and global variables
and use it to print better error messages in
tools that make use of it (Memcheck, Helgrind,
DRD) [no]
--freelist-vol=<number> volume of freed blocks queue [20000000]
--freelist-big-blocks=<number> releases first blocks with size>= [1000000]
--keep-stacktraces=alloc|free|alloc-and-free|alloc-then-free|none
stack trace(s) to keep for malloc'd/free'd areas [alloc-then-free]
The above will impact (increase or decrease) memory and/or cpu used by valgrind.
Philippe
|