编译C#与任何CPU内置应用程序可以处理大(大于2GB)地址 [英] Compiling C# with Any CPU sets Application can handle large (>2GB) addresses

查看:552
本文介绍了编译C#与任何CPU内置应用程序可以处理大(大于2GB)地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我性能测试期间遇到了这个问题。

I ran into this issue during performance testing.

在编译的x86平台国旗的C#控制台应用程序中,较大的地址标志未设置:

When compiling a C# Console application with the x86 platform flag, the Large Address Aware flag is not set:

从DUMPBIN输出/头APP.EXE:

Output from dumpbin /headers app.exe:

Dump of file app.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)
               3 number of sections
        569F0089 time date stamp Tue Jan 19 21:35:37 2016
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
             102 characteristics
                   Executable
                   32 bit word machine

在将该标志设置为任何CPU生成的exe文件是较大的地址:

When setting the flag to "Any Cpu" the resulting exe is Large Address Aware:

Dump of file app.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
             14C machine (x86)
               3 number of sections
        569F01D7 time date stamp Tue Jan 19 21:41:11 2016
               0 file pointer to symbol table
               0 number of symbols
              E0 size of optional header
              22 characteristics
                   Executable
                   Application can handle large (>2GB) addresses

注意应用程序可以处理大(> 2GB)地址标志设置。

Notice that the "Application can handle large (>2GB) addresses" flag is set.

我无法找到任何关于这一问题的文件。所有其它的堆栈溢出问题,建议你必须手动做到这一点:

I cannot find any documentation on this subject. All other stack overflow questions suggest you must do this manually:

<一个href=\"http://stackoverflow.com/questions/32777506/how-to-enable-image-file-large-address-aware-in-c-sharp-source-$c$c?lq=1\">How使在C#源$ C ​​$ C IMAGE_FILE_LARGE_ADDRESS_AWARE?

<一个href=\"http://stackoverflow.com/questions/2597790/can-i-set-largeaddressaware-from-within-visual-studio\">Can我在Visual Studio中设置LARGEADDRESSAWARE?

<一个href=\"http://stackoverflow.com/questions/12470446/use-the-3gb-of-memory-in-32-bits-applications?lq=1\">Use内存在32位应用程序的3Gb

现在的问题是:在哪里?这个记录

推荐答案

<一个href=\"http://blogs.msdn.com/b/rmbyers/archive/2009/06/08/anycpu-exes-are-usually-more-trouble-then-they-re-worth.aspx\"相对=nofollow>值为anycpu的目的是为了能够在x86和x64平台上运行的管理code,而在同一时间采取的x64平台上的更大的地址空间的优势。中的唯一途径要做到这一点是目标值为anycpu时标记二进制大地址识别。此外,如果不是这种情况下,它会一直没适当使preFER 32位的默认

The purpose of AnyCPU is to be able to run managed code on both x86 and x64 platforms while at the same time take advantage of the larger address space of x64 platforms. The only way to do this is to mark the binary as large address aware when targeting AnyCPU. In addition, if this was not the case, it would have not been appropriate to make Prefer 32-bit the default.

在哪里这个记录?

这还没有被明确记载,它是隐含的。

This has not been explicitly documented, it's implied.

所有其他堆栈溢出问题,建议你必须这样做手工。

All other stack overflow questions suggest you must do this manually

无论所有这些问题和答案的,这只是针对86时需要。

Irrespective of all of those questions and answers, this is required only when targeting x86.

这篇关于编译C#与任何CPU内置应用程序可以处理大(大于2GB)地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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