[英]Windows 7 64, how do I use more than 2 GB in C++
I am using Sublime Text 2 to write / compile / run C++ code. 我正在使用Sublime Text 2编写/编译/运行C ++代码。 However once the program uses ~2 GB memory, it quits.
但是,一旦程序使用〜2 GB内存,它就会退出。 I have more than enough memory.
我有足够的内存。 How do I increase this limit?
如何增加此限制?
Two options: 两种选择:
You need a 64-bit compiler. 您需要一个64位编译器。 You can install one using this installer .
您可以使用此安装程序安装一个。 Note you can also install a 32-bit compiler with the same installer.
请注意,您也可以使用相同的安装程序安装32位编译器。
For 32-bit applications: set a bit in the executable file that signals to Windows it can use up to 4GB of memory. 对于32位应用程序:在可执行文件中设置一个位,以向Windows发出信号,通知它可以使用多达4GB的内存。 To do this, add
-Wl,--large-address-aware
to you linker command. 为此,将
-Wl,--large-address-aware
到链接器命令。 This will give you 3GB on 32-bit Windows, and 4GB on 64-bit Windows. 这将在32位Windows上为您提供3GB,在64位Windows上为您提供4GB。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.