How do I avoid stack overflow error in my MATLAB code compiled using EMLMEX in MATLAB 7.7 (R2008b)?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 10 Nov. 2009
Bearbeitet: MathWorks Support Team
am 22 Jun. 2021
I have some MATLAB code which I compile using EMLMEX. The code runs fine in MATLAB, but throws a stack overflow error when trying to run the compiled code.
I have large data structures that I am passing to and returning from among functions and sub-functions in the MATLAB code.
Akzeptierte Antwort
MathWorks Support Team
am 22 Jun. 2021
Bearbeitet: MathWorks Support Team
am 22 Jun. 2021
A stack are allocated to each function by the operating system and there is no direct way to change the stack size.
Typically, the best way to avoid stack overflow issues would be to change the code in such a way that the variable sizes are not too large to be handled by a single function.
When using Microsoft Visual Studio, you can try setting the compiler flags /F and /STACK in MEXOPTS.BAT file or a compiler specific options file to request the operating system for a larger stack.
For details on these flags, see:
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Compiler finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!