title: Double free or corruption caused by vector
body: <p>The destructor for one of my classes (called <code>Distribution</code>) is throwing a <code>double free or corruption</code> error. When I do a backtrace, I get this:</p>
  
  <pre><code>#7  0x0000000000409212 in std::vector&lt;double, std::allocator&lt;double&gt; &gt;::~vector (
  this=0x7fffffff8f70)
  at /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/stl_vector.h:351
  #8  0x00000000004032c5 in Distribution::~Distribution (this=0x7fffffff8f28)
  at Distribution.cpp:165
  </code></pre>
  
  <p>So the error occurs when the <code>Distribution</code> destructor finishes and it tries to call the destructor on a vector. It's just a simple vector containing doubles, not pointers or anything. How could <code>~vector</code> be causing this error?</p>
  
  <p>ETA: I don't know that I can usefully provide a brief code example here. It happens in several places in my code that all have a lot going on and I don't have a good sense of which parts are relevant. Comments suggest it's a memory corruption issue so I can look for that.</p>