I'm having trouble allocating large arrays in C++ using gcc (using cygwin/MSYS in Windows). If I declare an array at the beginning of main as: unsigned int arr there's no problem, but even something as small (8 MB) as unsigned int arr will fail. This is something of a problem for me, since the program I'm working on requires large precalculations and an array of "only" a million elements just won't do it. Without those precalculations I'd have to do at least a dozen, and often more like 300, modulus operations inside a tight loop executing > 1 trillion times, and that just takes too much time. Am I doing something dumb? I did create the registry key heap_chunk_in_mb to 0x400 (1 GB) but I still get segmentation faults (or something) when I run the program with larger constants.