Why does 'Any CPU (prefer 32-bit)' allow me to allocate more memory than x86 under .NET 4.5?

前端 未结 1 1595
遇见更好的自我
遇见更好的自我 2021-01-01 17:21

According to many SO answers and this widely cited blog post, a .NET 4.5 application built for \'Any CPU\' with the \'prefer 32-bit\' option selected will run as a 32-bit pr

相关标签:
1条回答
  • 2021-01-01 17:53

    It turns out that, in Visual Studio 2015, building as 'AnyCPU (prefer 32-bit)' sets the IMAGE_FILE_LARGE_ADDRESS_AWARE bit on the executable (equivalent to running editbin /LARGEADDRESSAWARE on it), whereas it does not for an x86 build. This can be confirmed with dumpbin /HEADERS and looking for the line "Application can handle large (>2GB) addresses".

    This is not the case for Visual Studio 2013. The change is apparently undocumented.

    In theory, this should give the CLR an additional 2GB to play with. I don't know why the allocatable memory only goes up by about 300MB.

    0 讨论(0)
提交回复
热议问题