MATLAB crashes while re-running compiled mex file.
1 view (last 30 days)
Show older comments
I have a cpp file which gets compiled successfully in Matlab and gives right results. But if I recall the function again, then Matlab crashes. There is no issue if I recompile it again and then run. I assume it is due to some error as mentioned in this post . Why does it work if I recompile it each time and does not work (Matlab crashes) in case of recalling the function in a loop? - How to get hold of the error?
3 Comments
James Tursa
on 31 May 2016
This is usually the result of a memory access violation caused by a coding error, but we would need to see your code. The reason it may work the first time but not subsequent times is that the first time corrupts memory but doesn't access the corrupted memory until the second time. Recompiling may clear out the corrupted memory before it gets accessed.
Answers (0)
See Also
Categories
Find more on Elementary Math in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!