matlabwindows-1064-bitstack-size

What is the stack size of MATLAB?


What is the default stack size of MATLAB R2018a (64-bit)?

It seems that the stack-size is larger than an 64-bit C# program.

Why I'm asking that

I'm asking this question because I'm calling Intel MKLs LAPACKE_dtrtri which is heavily recursive.

I'm using that function inside .NET application and I'm getting a stack overflow error when calling it from C#, see What is the stack size of a BackgroundWorker DoWork Thread? Is there way to change it?

On the other side if I call my .NET application from MATLAB I'm not getting a stack overflow error. That's the reason I wanted to know what the stack size of MATLAB.


Solution

  • Using the dumpbin command I can take look at the header of the MATLAB.exe.

    dumpbin /headers "C:\Program Files\MATLAB\R2018a\bin\win64\MATLAB.exe"
    

    This returns

    Dump of file C:\Program Files\MATLAB\R2018a\bin\win64\MATLAB.exe
    
    PE signature found
    
    File Type: EXECUTABLE IMAGE
    
    FILE HEADER VALUES
                8664 machine (x64)
    ...
    
    OPTIONAL HEADER VALUES
    ...
             4000000 size of stack reserve
                1000 size of stack commit
              100000 size of heap reserve
                1000 size of heap commit
    

    The size of stack reserve is the stack size in hex.

    So the stack size of MATLAB is 67108864 Bytes which is 64 Mega Bytes.