I need help understanding under what circumstances I need to use -largeArrayDims when compiling a mex function. I build the binaries in old versions of Matlab to support the most users (R2007a, typically). But also want to be able to support future versions of Matlab because I only distribute the binary every couple of years.
I started using -largeArrayDims, because it seemed like I would need to, although I don't expect my binary to every need more than 2 Gb of memory. I haven't noticed any issues on MacOS, and 32/64-bit Linux, and 32-bit Windows.
I build the 64-bit Windows on Windows XP, with Matlab R2007a. On 64-bit Windows 7, my binary will crash Matlab in certain situations for all versions from R2009a through 2011b. But it is fine in older and newer versions. I figured out that if I don't use -largeArrayDims, then there are no problems.
So, do I really need to use -largeArrayDims? Will I be limiting my forward-compatibiltiy if I don't? Should I stop using -largeArrayDims on all platforms?
Thanks in advance for any help, thoughts, and comments.
I found the issue, and there was an error in my source code. As it turns out, I hadn't successfully made all of the required changes to support -largeArrayDims.
I had a few lines where I was doing:
x = (mwSize *) mxCalloc(N,sizeof(int));
So I just wasn't actually allocating enough space.
I'm not sure why this didn't break the 2008 and 2012 versions of Matlab, but now they all work.