为什么在64位Windows运行时为2GB内存限制? [英] Why 2 GB memory limit when running in 64 bit Windows?

查看:490
本文介绍了为什么在64位Windows运行时为2GB内存限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个开发Delphi应用程序的团队的成员。内存需求很大。 500 MB是正常的,但在某些情况下,它的内存异常。在这种情况下分配的内存通常在1000 - 1700 MB之间。



我们当然需要64位编译器,但现在不会发生(如果发生的话)也必须转换为unicode,但这是另一个故事...)。



我的问题是为什么在64位运行时每个进程有2 GB的内存限制环境。指针是32位,所以我认为4 GB将是正确的限制。
我使用Delphi 2007。



编辑:
所以如果我在Delphi中设置IMAGE_FILE_LARGE_ADDRESS_AWARE标志,使用: / p>

  {$ SetPeFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} 

在Windows Server 2003 x64上运行生成的Exe文件,应用程序可以寻址4 GB?




  • 我应该在boot.ini中设置/ 3GB开关吗?

  • 我们已经尝试过一个32位Windows Server 2003,似乎限制了Windows资源。日志中有GDIError的内存不足有更多例外。但是在64位操作系统中运行时可能会消失?


解决方案

如果您编译Delphi应用程序使用/ LARGEADDRESSAWARE标志,它将能够在64位操作系统上解决完整的4GB。否则,当在WOW32中运行时,操作系统假定应用程序期望与32位操作系统相同的环境,这意味着4GB的地址空间,2GB专用于操作系统,2GB分配给应用程序。


I'm a member in a team that develop a Delphi application. The memory requirements are huge. 500 MB is normal but in some cases it got out of memory exception. The memory allocated in that cases is typically between 1000 - 1700 MB.

We of course want 64-bits compiler but that won't happen now (and if it happens we also must convert to unicode, but that is another story...).

My question is why is there a 2 GB memory limit per process when running in a 64 bit environment. The pointer is 32 bit so I think 4 GB would be the right limit. I use Delphi 2007.

EDIT: So if I set the IMAGE_FILE_LARGE_ADDRESS_AWARE flag in Delphi by using:

{$SetPeFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}

And running the resulting Exe-file on a Windows Server 2003 x64 then the application can address 4 GB ?

  • Should I set /3GB switch in boot.ini ?
  • We have tried this but on a 32 bit Windows Server 2003 and it seems to limit the windows resources. There was more exceptions for "Out of memory" with GDIError in the log. But maybe this disappear when running in a 64 bit OS ?

解决方案

If you compile the Delphi application using the /LARGEADDRESSAWARE flag, it will be able to address the full 4GB on a 64-bit OS. Otherwise, when running in a WOW32, the OS assumes that the app is expecting the same environment that it would have on a 32-bit OS which means that of the 4GB of address space, 2GB is dedicated for the OS and 2GB is allocated to the application.

这篇关于为什么在64位Windows运行时为2GB内存限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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