MATLAB: StackOverflow exception when using Matlab Coder

matlab coder stackoverflow

Hello,
I'm a new user of Matlab Coder and I try to translate my Matlab code in C. My matlab code uses the Image toolbox, and in the entry-point function, I have a buffer of 1920*1080 pixels. So, when I generate the C code, the function has "const unsigned int buffer[2073600]" as an entry-point and I think that is the cause of the exception. So, how can I said to matlab coder to not write in the stack and take a pointer in entry-point ? Thank you for this community,
Baptiste

Best Answer

Hi Vidya, Thank you for your answer. I actually solved my problem: in a function we cannot have a temporary variable with a memory allocation bigger than 4Kb (I think), and I had 1920*1080 images. So I found the option of dynamic allocation in the settings of Matlab Coder and now it works.
Thank you,
Baptiste