设置了 LARGEADDRESSAWARE 标志的应用程序获得更少的虚拟内存 [英] Application with LARGEADDRESSAWARE flag set getting less virtual memory

查看:32
本文介绍了设置了 LARGEADDRESSAWARE 标志的应用程序获得更少的虚拟内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 32 位应用程序,包含一个 exe 和多个 dll.该 exe 是使用/LARGEADDRESSAWARE 标志集构建的.所以我希望在 64 位操作系统上我应该获得 4 GB 的用户地址空间.但是在某些 64 位 Win 7 系统上,我只能获得 2 GB 的用户地址空间.如果重要的话,物理内存是 8 GB.这种行为的原因是什么?

解决方案

浏览MSDN后,发现如下:

http:///msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx( 使用的 MEMORYSTATUSEX 页面GlobalMemoryStatusEx (http://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx) ) ullTotalVirtual 的描述是:<块引用>

对于 x86 处理器上的大多数 32 位进程,此值约为 2 GB,对于在启用 4 GB 调整的系统上运行的大地址感知的 32 位进程约为 3 GB.

4GB 调优页面是:http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs.85).aspx 它说的是:

<块引用>

在 64 位版本的 Windows 上,标有 IMAGE_FILE_LARGE_ADDRESS_AWARE 标志的 32 位应用程序有 4 GB 的可用地址空间.

Windows Server 2003 的 Itanium 版本:在 SP1 之前,32 位进程只有 2 GB 的可用地址空间.

此外,内存限制页面 (http://msdn.如果您想确定系统支持的总内存,microsoft.com/en-us/library/aa366778.aspx#memory_limits) 可以派上用场.

然而真正有用的信息来自 Mark Russinowich 的博客:http://blogs.technet.com/b/markrussinovich/archive/2008/07/21/3092070.aspx

<块引用>

虽然 4GB 是 32 位客户端 SKU 的许可限制,但有效限制实际上更低并且取决于系统的芯片组和连接的设备.原因是物理地址映射不仅包括 RAM,还包括设备内存,x86 和 x64 系统将所有设备内存映射到 4GB 地址边界以下,以保持与不知道如何处理的 32 位操作系统兼容地址大于 4GB.

所以结论是肯定的,这可能取决于系统的配置.也许你可以用一张表格来完成你的问题,包括你在每个系统上获得的内存量和一些重要的系统配置设置,我们可能会在这种情况下发现一个模式.

I have a 32 bit application consisting one exe and multiple dlls. The exe has been built with /LARGEADDRESSAWARE flag set. So I expect on a 64 bit OS I should get 4 GB of user address space. But on some 64 bit Win 7 systems I am getting only 2 GB of user address space. The physical memory is 8 GB if that matters. What could be reason for this behavior?

解决方案

After browsing through MSDN, I found the following:

On http://msdn.microsoft.com/en-us/library/windows/desktop/aa366770(v=vs.85).aspx (the page for MEMORYSTATUSEX which is used by GlobalMemoryStatusEx (http://msdn.microsoft.com/en-us/library/windows/desktop/aa366589(v=vs.85).aspx) ) the description for ullTotalVirtual is:

this value is approximately 2 GB for most 32-bit processes on an x86 processor and approximately 3 GB for 32-bit processes that are large address aware running on a system with 4-gigabyte tuning enabled.

The 4GB tuning page is: http://msdn.microsoft.com/en-us/library/windows/desktop/bb613473(v=vs.85).aspx and it says something like:

On 64-bit editions of Windows, 32-bit applications marked with the IMAGE_FILE_LARGE_ADDRESS_AWARE flag have 4 GB of address space available.

Itanium editions of Windows Server 2003: Prior to SP1, 32-bit processes have only 2 GB of address space available.

Also, the memory limits page (http://msdn.microsoft.com/en-us/library/aa366778.aspx#memory_limits) can come handy if you want to determine the total memory your system supports.

However the real useful information comes from Mark Russinowich's blog: http://blogs.technet.com/b/markrussinovich/archive/2008/07/21/3092070.aspx

While 4GB is the licensed limit for 32-bit client SKUs, the effective limit is actually lower and dependent on the system's chipset and connected devices. The reason is that the physical address map includes not only RAM, but device memory as well, and x86 and x64 systems map all device memory below the 4GB address boundary to remain compatible with 32-bit operating systems that don't know how to handle addresses larger than 4GB.

So the conclusion is that yes, this might depend on the configuration of the system. Maybe you can complete your question with a table, with the amount of the memory you get on each system and some important system configuration settings, and we might discover a pattern in this case.

这篇关于设置了 LARGEADDRESSAWARE 标志的应用程序获得更少的虚拟内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆