cvCreateMemStorage() not working in second object instance
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.
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.
It gets stuck at a c开发者_如何转开发all to cvCreateMemStorage(). The problem is illustrated here:
problem http://img573.imageshack.us/img573/9498/problemp.jpg 1st time, runs fine. 2nd time, problem!
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?
I've also tried freeing up the modelStorage memory when finished by putting cvReleaseMemStorage( &modelStorage ); in the classes destructor BUT no joy. It is like the memory is not being de-allocated correctly.
So, beautiful denizens of stackoverflow, any ideas? :(
精彩评论