如何创建一个(32位)的.NET应用程序使用3 GB的内存? [英] How do I create a (32-bit) .NET application to use 3 GB RAM?
问题描述
我创建.NET应用程序(C#),需要使用大量的内存。最近,我知道在32位版本的Windows XP的我只能用2 GB,除非我用的是 / 3GB
开关,并设置 IMAGE_FILE_LARGE_ADDRESS_AWARE
标记中的可执行文件头。但是,因为我正在开发一个.NET应用程序,我想我不能直接修改可执行文件,可以吗?所以,我应该怎么做才能让我的应用程序能够利用3 GB?
I am creating a .NET application (C#) that needs to use a lot of RAM. I recently knew that on 32-bit versions of Windows XP I can only use 2 GB, unless I use the /3Gb
switch, and set the IMAGE_FILE_LARGE_ADDRESS_AWARE
flag in the executable header. But since I'm developing a .NET application, I guess I cannot modify the executable directly, can I? So, what should I do to allow my application to utilize the 3 GB?
推荐答案
这是.NET的exe仍然是一个标准的PE文件;所以你可以尝试使用 EDITBIN / LARGEADDRESSAWARE
来设置标志,但请注意,如果你正在使用类似的ClickOnce(因为它维护的加密哈希,这将无法正常工作文件)。
An .NET exe is still a standard PE file; so you could try using editbin /LARGEADDRESSAWARE
to set the flag, but note that this won't work if you are using something like ClickOnce (since that maintains a cryptographic hash of the files).
不过,请注意,你仍然有相同的.NET限制在一个单一的对象/数组的最大规模而言。对于大量内存,64位是一个更好的主意。
However, note that you'll still have the same .NET limits in terms of the maximum size of a single object/array. For huge amounts of memory, x64 is a better idea.
这篇关于如何创建一个(32位)的.NET应用程序使用3 GB的内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!