I'm running a mex file in Matlab while debugging it in Visual Studio 2010. I mean that I'm running it in Matlab and when the m file reaches the call to the mex file, the focus automatically switches to VS and it stops in a break point i defined.
While I continue running in VS, I get the following message:
"Windows has triggered a breakpoint in MATLAB.exe.
This may be due to a corruption of the heap, which indicates a bug in MATLAB.exe or any of the DLLs it has loaded.
This may also be due to the user pressing F12 while MATLAB.exe has focus.
The output window may have more diagnostic information."
Immediately after that, I get the following message: Unhandled exception at 0x77a240f2 in MATLAB.exe: 0xC0000374: Corrupted heap (the exact message is in Hebrew, I translated it to English).
Well, I haven't got the slightest clue as to how to debug it. It doesn't necessarily happen in the same place every time. Does anyone know what it means? What went wrong?
Thanks in advance,
As I wrote in the comment, I got the same error. After a step by step commenting out of code I found the error.
I called the function
without initializing the field 'HAMILTON' in
correctly. Maybe this will help you finding the error.