Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

largeArrayDims causing problems on 64-bit Windows 7?

Asked by Roger on 5 Dec 2012

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.

0 Comments

Roger

Products

No products are associated with this question.

1 Answer

Answer by Roger on 6 Dec 2012
Accepted answer

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.

0 Comments

Roger

Contact us