title: C++ Any advice on tracking down Access Violations?
body: <p>I've been having issues trying to track down an Access Violation in my program.  It occurs when the destructor is called for the third time, exactly when the destructor appears to finish.</p>
  
  <p>I've spent hours trying to track this down so I'm looking for further advice on things I can do.  I'm creating the class instance with <code>new</code> and <code>delete</code> operators.  The Visual Studio output window shows:</p>
  
  <p><code>First-chance exception at 0x60e3ad84 (msvcp100d.dll) in WebCollationAgent.exe: 0xC0000005: Access violation writing location 0xabababab.
  Unhandled exception at 0x60e3ad84 (msvcp100d.dll) in WebCollationAgent.exe: 0xC0000005: Access violation writing location 0xabababab.</code></p>
  
  <p>Is there anything I can do to try and find out what was in those memory locations?</p>
  
  <p>The call stack window shows the following (in reverse order as I've pasted it in to chronological order, earliest to latest):</p>
  
  <pre><code>Program.exe!Network::`scalar deleting destructor'()  + 0x2b bytes   C++
  
  Program.exe!std::basic_string&lt;wchar_t,std::char_traits&lt;wchar_t&gt;,std::allocator&lt;wchar_t&gt; &gt;::~basic_string&lt;wchar_t,std::char_traits&lt;wchar_t&gt;,std::allocator&lt;wchar_t&gt; &gt;()  Line 754 + 0xf bytes    C++
  
  Program.exe!std::_String_val&lt;wchar_t,std::allocator&lt;wchar_t&gt; &gt;::~_String_val&lt;wchar_t,std::allocator&lt;wchar_t&gt; &gt;()  Line 478 + 0xb bytes  C++
  </code></pre>
  
  <blockquote>
    <p>msvcp100d.dll!std::_Container_base12::_Orphan_all()  Line 214 + 0x5 bytes   C++</p>
  </blockquote>
  
  <p>My best guess at this information is that there's some sort of string variable causing the issue?  Does anyone have any advice on interpreting this information?</p>
  
  <p>Any other pieces of advice would also be useful, thanks in advance.</p>
  
  <p>I'm coding under Windows 7 and using Visual Studio 2010 Professional.</p>