Can't create variable of weigth more than 2 Gb
-
Hi all,
I encountered a problem that bothers me. I know that on x32 bit system a program that were compiled with x32 compilator can't include variable of weight more than 2 Gb.
But my system is Windows x64, MSVC x64 compilator and I use Qt Creator 4.10.1 that is based on Qt 5.13.1 compiled with MSVC x32.
If I run:int data[2000][360000]; // 2.88 Gb
I get an error like:
C1126: automatic memory allocation exceeds 2G
Is that beacause my Qt is compiled with x32 compilator? -
@Please_Help_me_D said in Can't create variable of weigth more than 2 Gb:
Is that beacause my Qt is compiled with x32 compilator?
A 32-bit application cannot use more than 2 GB of memory, even if your operating system is 64-bit.
int data[2000][360000]; // 2.88 Gb
You cannot have 3 GB of data on your stack. Use the heap instead.
See https://software.intel.com/en-us/articles/memory-limits-applications-windows/