title: cvCreateMemStorage() not working in second object instance
body: <p>I have a class for a detection app (one method of which initialises the necessary buffers). The class is dynamically created and the init and run method is called when a button is pressed. It runs fine.</p>
  
  <p>However, if I finish the detection and return to the GUI and try to press the button again to create a new detection class and run it again, the app crashes.</p>
  
  <p>It gets stuck at a call to cvCreateMemStorage(). The problem is illustrated here:</p>
  
  <p><a href="http://img573.imageshack.us/img573/9498/problemp.jpg" rel="nofollow noreferrer">problem http://img573.imageshack.us/img573/9498/problemp.jpg</a>
  <em>1st time, runs fine. 2nd time, problem!</em></p>
  
  <p>First time around, the modelStorage gets initialised correctly. The second time around, it does not. I would have though that when the detection class is finished, all storage on the heap would be removed and I would be free to make the call to cvCreateMemStorage() in a new class?</p>
  
  <p>I've also tried freeing up the modelStorage memory when finished by putting cvReleaseMemStorage( &amp;modelStorage ); in the classes destructor BUT no joy. It is like the memory is not being de-allocated correctly.</p>
  
  <p>So, beautiful denizens of stackoverflow, any ideas? :(</p>