title: Segmentation fault when calling "new" in c++?
body: <p>I got segfault when trying to call "new" to create a pointer and push it into a vector. The code that I push the element in the vector is:</p>
  
  <pre><code>queue-&gt;push_back(new Box(gen_id, Interval(x_mid, x_end), Interval(y_mid-y_halfwidth, y_mid+y_halfwidth)));
  </code></pre>
  
  <p>Basically Box is a Class and the constructor just take 3 arguments, <code>generation_id</code>, and 2 <code>Intervals</code>. I printed out the content in vector before and after this "push", 
  before: </p>
  
  <pre><code>[ -0.30908203125, -0.3087158203125 ] , [ -0.951416015625, -0.9510498046875 ]
  [ -0.3087158203125, -0.308349609375 ] , [ -0.951416015625, -0.9510498046875 ]
  [ -0.30908203125, -0.3087158203125 ] , [ -0.9510498046875, -0.95068359375 ]
  [ -0.3087158203125, -0.308349609375 ] , [ -0.9510498046875, -0.95068359375 ]
  </code></pre>
  
  <p>after:</p>
  
  <pre><code>[ -0.30908203125, -0.3087158203125 ] , [ -0.951416015625, -0.9510498046875 ]
  [ -0.3087158203125, -0.308349609375 ] , [ -0.951416015625, -0.9510498046875 ]
  [ 8.9039208750109844342e-243, 6.7903818933216500424e-173 ] , [ -0.9510498046875, -0.95068359375 ]
  [ -0.3087158203125, -0.308349609375 ] , [ -0.9510498046875, -0.95068359375 ]
  [ -0.3087158203125, -0.308349609375 ] , [ -0.95123291015625, -0.95086669921875 ]
  </code></pre>
  
  <p>I have no clue why does this happen, but apparently, there's one element got corrupted. There's no other codes between these two sets of output except that "push", and I used gdb to confirm that. Also, I checked those 2 <code>Intervals</code> variables, both give me a result that make sense.</p>
  
  <p>My questions is: in what situation does "new" get segfault? Or is my problem caused because of other stuff?  Thanks.</p>