title: Force a std::vector to free its memory?
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/1111078/reduce-the-capacity-of-an-stl-vector">reduce the capacity of an stl vector</a><br>
    <a href="https://stackoverflow.com/questions/3172699/is-this-normal-behavior-for-a-stdvector">Is this normal behavior for a std::vector?</a>  </p>
  </blockquote>
  
  
  
  <p>I know that std::vectors do not 'free'  the memory when you call vector.clear(), but how can I do this? I want it to release all of its resources once I clear it but I don't want to destroy it. </p>
  
  <p>Here is what is happening right now.
  I have a class called OGLSHAPE and I push these into a vector of them. I was hoping that once I did shapevec.clear() I'd get all my memory back, but only got 3/4 of it back. I'm not 100% sure if this is a memory leak or not so I want to free all the resources to be sure its not a leak. Thanks</p>