title: Segmentation fault when push_back to vector c++
body: <p>I am trying to append a blank object to a list using the <code>push_back</code> method.</p>
  
  <p>main.cpp</p>
  
  <pre><code>    vector&lt;FacialMemory&gt; facial_memory;
  
      printf("2\n");
  
      // Add people face memories based on number of sections
      for (int i = 0; i &lt; QuadrantDict::getMaxFaceAreas(); i++)
      {
              printf("i %d\n", i);
              FacialMemory n_fm;
              facial_memory.push_back(n_fm);  // NOTE: Breaks here
      }
  </code></pre>
  
  <p>At the <code>push_back</code> method call, the program crashes with a segmentation fault. I have looked around at similar questions and they point to the solution I have here. I have also tried to pass <code>FacialMemory()</code> into the push_back call but still the same issue.</p>
  
  <p>The FacialMemory class is defined as such:
  FacialMemory.h</p>
  
  <pre><code>class FacialMemory
  {
  private:
          vector&lt;FaceData&gt; face_memory;
  public:
          FacialMemory();
          ~FacialMemory();
          void pushData(FaceData face);
          bool isEmpty();
          vector&lt;FaceData&gt; getFaces();
          FaceData getRecent();
  };
  </code></pre>
  
  <p>Constructor and destructor</p>
  
  <pre><code>FacialMemory::FacialMemory()
  {
  }
  
  
  FacialMemory::~FacialMemory()
  {
         delete[] &amp; face_memory;
  }
  </code></pre>