Visual Studio debug maximum buffer size

2019-08-11 11:40发布

问题:

When debugging my project in visual studio (2010) I get the message "no source available" once I step into one of my files. The file is now just a test file with one function:

void foo()
{
    float testbuf[200000] = {0};
}

If i allocate a smaller buffer the debugger enters the file normally. In my debugging view my "call stack location" is empty and there is "no disassembly available".

It looks to me like there is a maximum amount of data that the visual studio debugger can handle or something in this direction.

Could someone tell me if this is the problem and how I can fix it. Maybe some Visual Studio settings can help me out?

回答1:

I have found a way to avoid the problem. If I create the buffer "dynamically" by just malloc-ing the same big buffer then Visual Studio has no problem debugging my source file. Code example:

void foo()
{
    float *testbuf;
    testbuf = (float*) malloc(200000*sizeof(float)); // "dynamic" malloc
    memset(testbuf, 0, 200000*sizeof(float)); // Make sure buffer is empty.
    // Code (irrelevant to example)
    free(testbuf);
}

So this does not answer the question what the maximum capacity of stack memory is for the visual studio debugger but it does provide a workaround to the problem.

I hope this will help someone.