title: How to locate a free/delete mismatch reported by Valgrind in a multithreaded program?
body: <p>Here is the Valgring report:</p>
  
  <pre><code>==14546== Thread 5:
  ==14546== Invalid free() / delete / delete[]
  ==14546==    at 0x490555D: free (vg_replace_malloc.c:235)
  ==14546==    by 0x3BF7EFAA8F: free_mem (in /lib64/tls/libc-2.3.4.so)
  ==14546==    by 0x3BF7EFA581: __libc_freeres (in /lib64/tls/libc-2.3.4.so)
  ==14546==    by 0x4802676: _vgw_freeres (vg_preloaded.c:62)
  ==14546==  Address 0x4DC4EE0 is not stack'd, malloc'd or (recently) free'd
  </code></pre>
  
  <p>How can I know which thread is it as the thread number varies from one execution to another ? Will <a href="http://valgrind.org/docs/manual/drd-manual.html#drd-manual.naming-threads" rel="noreferrer">assigning names to my threads</a> help here ? </p>
  
  <p><strong>EDIT</strong>: I don't think it will as this is mentioned in the DRD section of the manual.</p>
  
  <p>I'm using valgrind-3.1.1 on Red Hat enterprise Linux AS4. </p>