Stack allocation for functions

Is there any quantitative testing of functions in modules / source files regarding memory allocation, as shown in the following 32-bit assembly:

#include <windows.h>

int main()
{
wchar_t TestArray [516332]  = { NULL };
}

This succeeds for 516332 (or 7E0EC), but creates a stack overflow for 516333. Of course, a global 2Gb or 7FFFFFFF declaration is legal, but add it to get SO.

#include <windows.h>
wchar_t TestArray [2147483647]  = { NULL };
int main()
{
}

Using VS10 / MCBS in a 32-bit build, but the X64 doesn't play well. Is there a proportional increase for function types (e.g. long, char void, bool) on 64 or 128 systems? In particular, search for answers using a numerical / tabular approach.

+4
source share
2

, , :

int main()
{
    wchar_t TestArray [516332]  = { NULL };
}

1 ( ). /STACK:reserve[,commit] Visual Studio.

wchar_t TestArray [2147483647]  = { NULL };
int main()
{
}

2 32- ( /3GB).

+1

- "". "", . , , ++ ( C) , ( , , - ).

64- - , - 128- , , 64- 53 - , . , , 48 , 65536 * 4 256 . 1-2 , , , .

, 32- , . , - , , , [ , "" , ]. , , , , , wchar_t, , "".

- :

std::wstring TestString(size);

, - , ( , 2 ).

+1

Source: https://habr.com/ru/post/1623569/


All Articles