- If the MEX function is located inside the MATLAB root folder and is an official MathWorks function, contact MathWorks Technical Support for further assistance along with reproduction steps and relevant files.
- If you are not the author of this MEX function, you may want to contact the author for help in troubleshooting this MATLAB crash. The original author may assist in troubleshooting the MEX function, or they may provide you with the source code so that you may troubleshoot the MEX function yourself.
How do I identify the MEX function that caused MATLAB to crash?
33 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
MathWorks Support Team
il 15 Apr 2015
Modificato: MathWorks Support Team
il 12 Ago 2024
MATLAB crashed when I tried running my code and I believe the cause of the crash was a MEX function due to the following message at the bottom on the MATLAB crash log:
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
How can I determine from the crash log which MEX function caused the crash?
Risposta accettata
MathWorks Support Team
il 16 Lug 2024
Modificato: MathWorks Support Team
il 12 Ago 2024
The "mexFunction" function is the name of the gateway function which every MEX function built with the C MEX API, Fortran MEX API, and CUDA runtime API requires. The frame line that contains the "mexFunction" keyword from the "Stack Trace" section of the crash log is the one which contains the name of the MEX function that caused the crash. Here is an example frame line from a stack trace containing the "mexFunction" keyword:
[ 15] 0x00007f93f0200fb0 /usr/share/psychtoolbox-3/PsychBasic/Screen.mexa64+00769968 mexFunction+00000700
In this example, the "Screen.mexw64" MEX function from the third-party Psychtoolbox Toolbox appears to be the one that caused MATLAB to crash.
If the MEX function is built using the C++ MEX API, "mexFunctionAdapter" will be the name of the gateway function which appears in the stack trace. Similarly, the frame line that contains the "mexFunctionAdapter" keyword from the "Stack Trace" section is the one which contains the name of the MEX function that caused the crash. Here is an example frame line from a stack trace containing the "mexFunctionAdapter" keyword:
[ 1] 0x000000006aa05323 C:\Users\user1\Documents\arrayProduct.mexw64+00021283 mexFunctionAdapter+00000531
In this example, the custom MEX function "arrayProduct.mexw64" appears to be the one that caused MATLAB to crash.
Finally, please keep the following additional guidelines in mind when investigating the MEX function that caused MATLAB to crash:
For more information regarding MEX functions, refer to the documentation page "Choosing MEX Applications".
For more information regarding troubleshooting a MATLAB crash associated with a MEX function, refer to the article "How do I troubleshoot a MATLAB crash associated with a MEX function?".
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Write C Functions Callable from MATLAB (MEX Files) in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!