title: C++ program dies with std::bad_alloc, BUT valgrind reports no memory leaks
body: <p>My program fails with 'std::bad_alloc' error message. The program is scalable, so I've tested on a smaller version with valgrind and there are no memory leaks. </p>
  
  <p>This is an application of statistical mechanics, so I am basically making hundreds of objects, changing their internal data (in this case stl vectors of doubles), and writing to a datafile. The creation of objects lies inside a loop, so when it ends the memory is free. Something like:</p>
  
  <pre><code>for (cont=0;cont&lt;MAX;cont++){
           classSection seccion;
           seccion.GenerateObjects(...);
           while(somecondition){
                  seccion.evolve();
                  seccion.writedatatofile();
           }}
  </code></pre>
  
  <p>So there are two variables which set the computing time of the program, the size of the system and the number of runs. There is only crash for big systems with many runs. Any ideas on how to catch this memory problem?</p>
  
  <p>Thanks, </p>