MATLAB: Does the MEX file that used to work before R2017a now crash MATLAB

crashMATLABmexr2017a

I wrote a MEX file a few years ago and it worked fine in MATLAB. After upgrading to MATLAB R2017a and recompiling the MEX file, however, it now crashes MATLAB on execution. What has changed that would cause this to happen?

Best Answer

In MATLAB R2017a, the mex function uses the large-array-handling API (-largeArrayDims option) by default. If your older MEX file code was written without consideration of this change, it is possible that it will now crash MATLAB.
Best practice is to update your MEX source code to use this library and rebuild the MEX file. For instructions, see:
If you do not update your MEX source code, you can still build your MEX files using the -compatibleArrayDims option. For information about the consequences of using the -compatibleArrayDims option to build MEX files, see:
Related Question