[Valgrind-users] Best valgrind options for finding corrupt memory

2014-01-14 Thread Samuel Quiring
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?

-Sam

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] Best valgrind options for finding corrupt memory

2014-01-14 Thread David Faure
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)

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] Best valgrind options for finding corrupt memory

2014-01-14 Thread gene.fortan...@freescale.com
Hi,

Yes defaults. Starting at 4:52 of this YouTube video you will see this fellow 
determine that his code also has the strlen problem with malloc:
http://www.youtube.com/watch?v=fvTsFjDuag8


Bye,
Gene Fortanely | Freescale Semiconductor


-Original Message-
From: David Faure [mailto:fa...@kde.org] 
Sent: Tuesday, January 14, 2014 10:05 AM
To: valgrind-users@lists.sourceforge.net
Cc: Samuel Quiring
Subject: Re: [Valgrind-users] Best valgrind options for finding corrupt memory

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)

--
David Faure, fa...@kde.org, http://www.davidfaure.fr Working on KDE, in 
particular KDE Frameworks 5


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users



--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users


Re: [Valgrind-users] Best valgrind options for finding corrupt memory

2014-01-14 Thread Philippe Waroquiers
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|noread 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 [2000]
--freelist-big-blocks=number   releases first blocks with size= [100]
--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



--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments  Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431iu=/4140/ostg.clktrk
___
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users