_BLOCK_TYPE_IS_VALID assertion occurring in dbgdel.cpp
<p>I'm quite new to these kinds of errors, apologies if this problem is a bit specific. This is the call stack for the error, the reason I've posted it is because I'm relatively new to looking at these things. I don't really know what the error means, but by looking at the calls it seems to me that I need to know what it means when it says ::_Destroy, because I get this error when the program starts up and nothing should be being destroyed at this point (I'm guessing I might be confused about a whole lot of things here though)</p>

<p>I also notice that (I think) the destructors for Brain and Agent are being called. When the program starts nothing should be having its destructor called. Is this in fact what is happening? Do destructors get called when programs fail like this? Or are they actually being called as planned and this is the problem?</p>

<p>I read that the error is something to do with memory being overwritten? what kinds of things do I need to be looking for for the cause of this?</p>

<p>please let me know if any more information is required.</p>

<pre><code>&gt;   msvcr100d.dll!operator delete(void * pUserData)  Line 52 + 0x51 bytes   C++
D3D10DEMO.exe!Gun::`scalar deleting destructor'()  + 0x3c bytes C++
D3D10DEMO.exe!Brain::~Brain()  Line 79 + 0x3c bytes C++
D3D10DEMO.exe!Agent::~Agent()  + 0x2b bytes C++
D3D10DEMO.exe!Agent::`scalar deleting destructor'()  + 0x2b bytes   C++
D3D10DEMO.exe!std::_Destroy&lt;Agent&gt;(Agent * _Ptr)  Line 64   C++
D3D10DEMO.exe!std::allocator&lt;Agent&gt;::destroy(Agent * _Ptr)  Line 213 + 0x9 bytes    C++
D3D10DEMO.exe!std::_Dest_val&lt;std::allocator&lt;Agent&gt;,Agent&gt;(std::allocator&lt;Agent&gt; &amp; _Alval, Agent * _Pdest)  Line 288 C++
D3D10DEMO.exe!std::_Destroy_range&lt;std::allocator&lt;Agent&gt; &gt;(Agent * _First, Agent * _Last, std::allocator&lt;Agent&gt; &amp; _Al, std::_Nonscalar_ptr_iterator_tag __formal)  Line 97 + 0xd bytes   C++
D3D10DEMO.exe!std::_Destroy_range&lt;std::allocator&lt;Agent&gt; &gt;(Agent * _First, Agent * _Last, std::allocator&lt;Agent&gt; &amp; _Al)  Line 88 + 0x2f bytes C++
D3D10DEMO.exe!std::vector&lt;Agent,std::allocator&lt;Agent&gt; &gt;::_Destroy(Agent * _First, Agent * _Last)  Line 1270 + 0x14 bytes    C++
D3D10DEMO.exe!std::vector&lt;Agent,std::allocator&lt;Agent&gt; &gt;::reserve(unsigned int _Count)  Line 765 C++
D3D10DEMO.exe!std::vector&lt;Agent,std::allocator&lt;Agent&gt; &gt;::_Reserve(unsigned int _Count)  Line 1298   C++
D3D10DEMO.exe!std::vector&lt;Agent,std::allocator&lt;Agent&gt; &gt;::push_back(Agent &amp;&amp; _Val)  Line 647 C++
D3D10DEMO.exe!Initialise(HWND__ * hWnd)  Line 38 + 0xbe bytes   C++
D3D10DEMO.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow)  Line 47 + 0x9 bytes    C++
D3D10DEMO.exe!__tmainCRTStartup()  Line 547 + 0x2c bytes    C
D3D10DEMO.exe!WinMainCRTStartup()  Line 371 C
</code></pre>
