大地址感知标志如何在 64 位计算机上用于 32 位应用程序?
我读到过,32 位 Windows 应用程序仅限于 2 GB RAM,因为上面的 2GB 寻址空间是为 Windows 操作系统(以及 iirc、VRAM)保留的。如果您在 32 位 WinXp 上使用 /3GB 标志,您可能会获得最多 3 GB 的 RAM 可用于寻址,但通常您必须调整 userva 值。我听说在 64 位版本的 Windows 上,PE 头中有一个大的地址感知标志和超过 4 GB 的 RAM,应用程序可以使用所有 4 GB 的寻址空间来进行自己的内存管理。
另一方面,我非常确定当您调用 Windows API 时,您必须调用所提供的 32 位地址空间内的内存位置。那么,32 位大地址感知应用程序在 64 位环境中究竟可以使用多少 RAM?为什么?
谢谢。
I've been reading that 32bit Windows applications are limited to 2 GB RAM because the upper 2GB of addressing space is reserved for the Windows OS (and, iirc, VRAM). If you use the /3GB flag on 32-bit WinXp you might get up to 3 GB of RAM available for addressing, but usually you have to tweak with userva values. I've heard that on 64 bit editions of Windows, with a large address aware flag in the PE header and over 4 GB of RAM, it is possible for an application to use all 4 GB of addressing space for its own memory management.
On the other hand, I'm pretty sure that when you call the windows API, you have to call memory locations within the 32-bit address space you're provided. So, exactly how much RAM can a 32-bit large address aware application use for itself in a 64-bit environment, really? And why?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虚拟地址空间扩展至4GB。如果您不使用地址窗口扩展 API< /a>,您可以访问的最大内存量为 4GB。其中一些空间将被操作系统占用用于 .dll 和其他此类内容,但您可以收回使用所有 32 位指针的内存。
顺便说一句,如果您不知道大地址,则所有内存指针在转换为
INT_PTR
时都不会为负。当使用大地址感知标志时,这实际上是多个微妙错误的根源,因为指针被视为有符号值。The virtual address space is extended to 4GB. If you don't use the Address Windowing Extension API, the maximum amount of memory you can access is 4GB. Some of that space will be taken up by the OS for .dlls and other such things, but it will be possible for you to get memory back that uses all 32-bits of a pointer.
Incidentally, if you aren't large address aware, all memory pointers will not be negative when cast to a
INT_PTR
. This is actually a source of more than a few subtle bugs when using the large address aware flag, as pointers are treated signed values.