[Mesa-dev] [PATCH] util: add more memory debugging features

Jose Fonseca jfonseca at vmware.com
Wed Nov 28 13:14:29 PST 2012



----- Original Message -----
> On 11/28/2012 12:39 PM, Brian Paul wrote:
> > Add a DEBUG_FREED_MEMORY option to help catch use-after-free
> > errors.
> > Add debug_memory_check() function which can be periodically called
> > to
> > check that all known blocks are good.
> > ---
> >   src/gallium/auxiliary/os/os_memory_debug.h  |    3 +
> >   src/gallium/auxiliary/util/u_debug_memory.c |   82
> >   ++++++++++++++++++++++++++-
> >   2 files changed, 84 insertions(+), 1 deletions(-)
> 
> Perhaps a stupid question, but isn't this exactly what valgrind is
> designed for?  (It works exceeding well at...you can even use
> --db-attach=yes to set a breakpoint at the exact location where you
> read/write the invalid memory...)

There is no valgrind for windows...

There is http://www.drmemory.org/ , a similar tool, but I still feel that u_debug_memory is quite handy.

I hope one day to improve this so that it doesn't need to use macros + __FUNCTION__ __LINE__ to figure the names, so that we can track all memory without source modification at all.

Jose


More information about the mesa-dev mailing list