Forum Discussion
Anyone single 64-bit process only can be allocated 4GB memory in my WIN10.How to make it more?
- Aug 05, 2020
This is not correct and there is no 4GB limit imposed by Windows 10 for any 64-bit process.
The limits are as follows on 64-bit Windows 10:
32-bit process w/o large address aware: 2GB
32-bit process with large address aware: 4GB
64-bit process w/o large address aware: 2GB
64-bit process with large address aware: 128TB
The large address aware flag ist a flag set by the linker when linking the compiled program. Normally every 64-bit executable should have it set. If not, you get a maximum of 2GB even for 64-bit processes.
If you want to test how much memory your system can allocate for a single 64-bit process, download testlimit64.exe from Microsoft Sysinternals and use the following command lines:
testlimit64.exe -m 1024
testlimit64.exe -d 1024
The first command will only allocate the virtual memory addresses and does not touch them, the second one also touches the memory. So the first one shows you what is possible with your system resources, the second one goes up to the limit your RAM and pagefile can handle.
This is not correct and there is no 4GB limit imposed by Windows 10 for any 64-bit process.
The limits are as follows on 64-bit Windows 10:
32-bit process w/o large address aware: 2GB
32-bit process with large address aware: 4GB
64-bit process w/o large address aware: 2GB
64-bit process with large address aware: 128TB
The large address aware flag ist a flag set by the linker when linking the compiled program. Normally every 64-bit executable should have it set. If not, you get a maximum of 2GB even for 64-bit processes.
If you want to test how much memory your system can allocate for a single 64-bit process, download testlimit64.exe from Microsoft Sysinternals and use the following command lines:
testlimit64.exe -m 1024
testlimit64.exe -d 1024
The first command will only allocate the virtual memory addresses and does not touch them, the second one also touches the memory. So the first one shows you what is possible with your system resources, the second one goes up to the limit your RAM and pagefile can handle.
I had similar issue exceeding 2GB alloc but setting largeaddressaware didn't help. Turns out that when I calculate the alloc size in the bracket the calculation is done in signed 32bit integer and overruns to a negative value, hence bad alloc. I had to change a lot of indices to 64bit ints to work with bigger arrays, not just the allocation. int is no longer the unlimited iterator :)
I added this: using int64 = long long;
so I can avoid the truly ugly type name mess that is c++. I also defined int8
This was annoying to figure out, you guys were no help at all :)