Stack overflow using the generated C++ code
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Lukai Cai
am 23 Feb. 2018
Beantwortet: Lukai Cai
am 27 Feb. 2018
I generated the code using Matlab Coder, and integrated into MSVC of another project. During run time, it gives stack overflow error. I tried to use memory optimization feature (Enable variable-sizing, and reduce stake usage max to 100,000). The simulation goes a little further but still give stack overflow in another function call. Just need to know how to address it.
Really appreciate it!
1 Kommentar
Denis Gurchenkov
am 23 Feb. 2018
Hi Lukai,
- If you generate a MEX file and run it from MATLAB directly (without integrating your code with another project), does it work on same input data? Or does it give you some error?
- If you run your project with MSVC debugger attached, does it give you a stack trace? -- Check the stack trace for signs of infinite recursion (same functions called again and again) -- Check the bodies of functions involved for presence of local variables of huge sizes (e.g. real_T buf[100000]) -- If you have Embedded Coder, use the "static code metrics" link in the compilation report, there you can see stack sizes for all functions in the generated code.
hth,
Denis.
Akzeptierte Antwort
Weitere Antworten (2)
Lukai Cai
am 23 Feb. 2018
5 Kommentare
Denis Gurchenkov
am 23 Feb. 2018
Or just contact MathWorks technical support if you are not comfortable posting source code online.
Siehe auch
Kategorien
Mehr zu MATLAB Coder finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!