windows 64 位系统上 32 位应用程序的内存分配限制
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2222901/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
memory allocation limit for a 32-bit app on a 64-bit system
提问by asteroid
Is the max limitation for malloc (virtual heap I guess?) for a 32-bit app on a 64-bit system (Windows 2003 SP2 x64, to be specific) 2GB?
对于 64 位系统(Windows 2003 SP2 x64,具体来说)上的 32 位应用程序,malloc(我猜是虚拟堆?)的最大限制是 2GB?
I'm basically trying to push a program beyond that with no luck. So I was wondering if that holds true for ALL 32-bit apps on Win x64 bit platforms.
我基本上是想在没有运气的情况下推动一个程序超越它。所以我想知道这是否适用于 Win x64 位平台上的所有 32 位应用程序。
Thank you!
谢谢!
回答by villintehaspam
You should link your application with /LARGEADDRESSAWAREto make more than 2GB available to the application. Then you can use up to 4GB on a 64-bit OS in a 32-bit application.
您应该将您的应用程序与/LARGEADDRESSAWARE链接,以便为应用程序提供超过 2GB 的可用空间。然后,您可以在 32 位应用程序中的 64 位操作系统上使用最多 4GB。
回答by Robert Groves
32-bit apps have a virtual address space allowing up to 4GB to be addressed on a 64-bit version of windows.
32 位应用程序有一个虚拟地址空间,允许在 64 位版本的 Windows 上寻址高达 4GB。
The 4-Gigabyte Tuningsection in the Win32 and COM Development doc on MSDN, explains the /LARGEADDRESSAWARElinker switch. Switching it on will allow 32-bit apps to address up to 4GB of memory.
MSDN 上的 Win32 和 COM 开发文档中的4-Gigabyte Tuning部分解释了/LARGEADDRESSAWARE链接器开关。将其打开将允许 32 位应用程序寻址高达 4GB 的内存。
See the Memory Management sectionin the MSDN Library. Use of the WIN32 memory management services functions provides functionality that is not available in the C run-time library. Whether or not you need this functionality is up to you.
请参阅MSDN 库中的内存管理部分。使用 WIN32 内存管理服务函数提供了 C 运行时库中不可用的功能。您是否需要此功能取决于您。