Very simple application crashing on close [closed]

asked 2013-10-03 04:13:08 -0600

IngDante gravatar image

updated 2013-10-03 07:43:18 -0600

Hi guys,

this is my very first post here, sorry if I do something wrong :)

I am definitely a newbie so I am probably making a very stupid mistake... I need to find the center of a circle in a still image, and I found this code which works as expected: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html#code

But for some reason, the program crashes when it exits (everything is fine until the "return 0;" instruction). I realized that it crashes only if at least one circle has been detected, otherwise it closes without errors. I guess something goes wrong with memory but I don't know exactly how to find out where the problem is. It looks like a bad segmentation fault...

I'm working on a Windows7 64bit machine, with OpenCV 2.4.6 and Visual Studio 2008 (I am creating a win32 application).

Do you have any idea about how I could spot the cause of this?

Thanks for your help ;)

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-20 03:39:04.279624

Comments

Do you use exactly this code? Could you post the assertation / exception / stacktrace or whatever additional info you have? Probably try to call destroyAllWindows() before return 0. This closes the windows created with imshow.

ThomasB gravatar imageThomasB ( 2013-10-03 07:55:18 -0600 )edit

Hi Thomas! Yes, the code is pretty much the same, I have just hard-coded a string rather than using a command line argument as the path to a JPEG image. The strange thing is that in "debug mode" (i.e. compiling using the libraries with the "-d" suffix), everything works as expected. The only information I can get from Visual Studio is that the heap is somehow "damaged":

> HEAP[myNewOpenCv.exe]: Invalid address specified to RtlFreeHeap( 003C0000, 0044D178 )

This error occurs on close, no matter whether I call destroyAllWindows() or not. You can download my VS2008 project here: http://tinyurl.com/ogbhnja (it's a zip on Dropbox); I guess there could be something wrong in my project settings (compiler/linker)...thanks!

IngDante gravatar imageIngDante ( 2013-10-03 10:26:16 -0600 )edit

Have a look on this; http://answers.opencv.org/question/6495/visual-studio-2012-and-rtlfreeheap-error/ It seems to be a common issue with Microsoft IDEs, also with older ones and older versions of OpenCV, for example here: http://opencv-users.1802565.n2.nabble.com/new-to-openCV-have-question-about-cvReleaseImage-error-in-in-VC-2003-td2268910.html . I'm developing with Linux, never experienced these errors so far :)

ThomasB gravatar imageThomasB ( 2013-10-03 12:54:26 -0600 )edit

Thank you very much. I always develop on Linux, this is my very first time on Windows... Anyway, it looks like I may be luckier with a DLL (someone says this problem does not occur in that case), which is exactly what I would need in the end...I'll give it a try in the next few days :)

IngDante gravatar imageIngDante ( 2013-10-04 09:59:33 -0600 )edit