I am passing an array to a mex file as follows:
var = (float*)mxGetPr(prhs);
The mex file compiles/work perfect when the input is "small" (a few GB for my application), but when the input is larger, it crashes and gives me a segmentation fault. The input is held in memory (loaded into matlab workspace), and furthermore, the mex file shouldn't make a copy of the array (I'm just pointing to the array which is already in memory). Not only that, but I only need to access few elements of the input array at a time.
Any ideas on what could be causing this behavior?
One obvious candidate: I'm not compiling with -largeArrayDims (didn't update my code for 64-bit API). Might this be an issue?