问题
I am using glmnet library within my codebase in Matlab without problems during normal operation. However the moment I use Matlab's 'run and time' feature to analyse performance of my codebase, Matlab throws an access violation. The Mex file is the one that is shipped with the package.
Is there a fundamental incompatibility of mex files and 'run and time', or do Mex files have to be strictly written to conform to 'run and time' runtime standards (perhaps to do with memory allocation/deallocation)?
I don't want to start digging around in the third party code - all I want is for the profiler to tell me how long was spent executing the mex file in the context of my codebase - I am not interested in what is going on in the mex file. Is there a way to configure the profiler to deal with the mex file in this way?
The stack trace is as follows:
------------------------------------------------------------------------
Access violation detected at Wed Jul 26 10:10:39 2017
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Current Graphics Driver: Unknown hardware
Default Encoding : windows-1252
Deployed : false
Graphics card 1 : Intel Corporation ( 0x8086 ) Intel(R) Iris(TM) Plus Graphics 640 Version 21.20.16.4664
Host Name : DESKTOP-MARUMC2
MATLAB Architecture : win64
MATLAB Entitlement ID: 1208320
MATLAB Root : C:\Program Files\MATLAB\R2016b
MATLAB Version : 9.1.0.441655 (R2016b)
OpenGL : hardware
Operating System : Microsoft Windows 10 Home
Processor ID : x86 Family 6 Model 142 Stepping 9, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : Version 10.0 (Build 14393)
Fault Count: 1
Abnormal termination:
Access violation
Register State (from fault):
RAX = 0000000000000000 RBX = 0000000000000000
RCX = 00000000fc615760 RDX = 00000000043f8d10
RSP = 00000000043f7128 RBP = 00000000043f8d10
RSI = 00000000aaf4ba00 RDI = 0000000000000000
R8 = 00000000043f7f30 R9 = 00000000fc615760
R10 = 0000000000000000 R11 = 00000000043f8d10
R12 = 0000000000000001 R13 = 0000000000000000
R14 = 00000000043f8d10 R15 = 00000000fc615760
RIP = 000000018008346f EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x000000018008346f C:\Program Files\MATLAB\R2016b\bin\win64\libmx.dll+00537711 MXGETPR+00000003
[ 1] 0x00007ffb629619dc C:\Users\work\glmnet_matlab\glmnetMex.mexw64+00006620 MEXFUNCTION+00002524
来源:https://stackoverflow.com/questions/45323117/matlabs-run-and-time-crashes-with-mex-file