title: C++ leaking memory with boost::ptr_vector
body: <p>When opening up the task manager to see the memory usage, it will begin with .3MB memory used. After adding 100,000 objects to the ptr_vector, there is 2.3MB of memory used. After using .clear() on the vector, the memory goes to .8-.9MB. What is the cause of this increased memory usage?</p>
  
  <p>Here's the code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/ptr_container/ptr_vector.hpp&gt;
  
  class T {
  public:
      static int nObjects;
      T() {
          nObjects++;
      }
      ~T(){
          nObjects--;
      }
  };
  
  int T:: nObjects = 0;
  
  int main() {
      boost::ptr_vector&lt;T&gt; vec;
      char pause;
      std::cout &lt;&lt; "Press any key to continue: ";
      std::cin &gt;&gt; pause;
  
      for(int i=0; i&lt;100000; i++) {
          vec.push_back(new T);
      }
  
      std::cout &lt;&lt; T::nObjects &lt;&lt; " objects created." &lt;&lt; std::endl;
  
      std::cout &lt;&lt; "Press any key to continue: ";
      std::cin &gt;&gt; pause;
  
      vec.clear();
      std::cout &lt;&lt; T::nObjects &lt;&lt; std::endl;
  
      std::cout &lt;&lt; "Press any key to exit: ";
      std::cin &gt;&gt; pause;
      return 0;
  }
  </code></pre>
  
  <p>Thanks for the help.</p>