cvCreateMemStorage() 在第二个对象实例中不起作用
我有一个检测应用程序的类(其中一种方法初始化必要的缓冲区)。该类是动态创建的,按下按钮时会调用 init 和 run 方法。它运行良好。
但是,如果我完成检测并返回 GUI 并尝试再次按下按钮以创建新的检测类并再次运行它,应用程序就会崩溃。
它在调用 cvCreateMemStorage() 时陷入困境。该问题如下所示:
问题 http://img573.imageshack.us/img573/9498 /问题.jpg 第一次,运行良好。第二次,问题!
第一次,modelStorage 被正确初始化。第二次,却没有。我想,当检测类完成时,堆上的所有存储都将被删除,我可以在新类中自由地调用 cvCreateMemStorage() 吗?
我还尝试在完成后释放 modelStorage 内存,方法是放置 cvReleaseMemStorage( &modelStorage );在类析构函数中但没有乐趣。这就像内存没有被正确解除分配。
那么,stackoverflow 的美丽居民们,有什么想法吗? :(
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 call 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? :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论