How to Set Largeaddressaware from Within Visual Studio

Can I set LARGEADDRESSAWARE from within Visual Studio?

You can do it as a Post-build task. In "Build Events" tab, put following command

editbin /largeaddressaware $(TargetPath)

into the "Post-build event command line:"

This is the case for VS2008. I think it should work in the same way for VS2010.

LargeAddressAware Visual Studio 2015 C#

The issue was caused when uninstalling the Visual Studio 2015 RC version. It does not remove all the directories and therefore the install of the full release version is not successful. The simple solution is to uninstall the RC version and restart. Then manually delete the C:\Program Files (x86)\Microsoft Visual Studio 14.0 directory. Then you can install the the new version without any issues.

Credit Hans Passant for identifying this issue.

Setting LARGEADDRESSAWARE on a C# project with references?

It is not an option that's exposed by the IDE, you'll to turn it on by running editbin.exe in a post-build event. This answer shows the commands you need to use.

Do note however that it is fairly likely that you are wasting energy on this. It will only have an effect when the operating system can provide an execution environment that supports "large addresses". That used to be possible many years ago with the /3GB boot option but has stopped being useful a while ago. Also very detrimental on servers, they really need the kernel address space. It is still useful when your server boots a 64-bit version of Windows, any 32-bit code can get a 4 GB address space if they are linked with /LARGEADDRESSAWARE. But if you have such an operating system then changing the project's Target platform to AnyCPU is certainly the much more productive way to take advantage of the much larger address space you get in a 64-bit process. Maybe that doesn't apply in your specific case but is otherwise the best general advice.

How to make a .NET application large address aware?

The flag is part of the image header, so you need to modify that using editbin.

editbin /LARGEADDRESSAWARE <your exe>

Use dumpbin /headers and look for the presence of Application can handle large (>2GB) addresses to see if the flag is set or not.

verify if largeAddressAware is in effect?

Yes there is, and the necessary tool is included with VS.

Open the "Visual Studio Command Prompt (2010)" console from the start menu, and CD into C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE (adjust for your own system if you have changed the installation directory or run 64-bit Windows).

Then do:

dumpbin /headers devenv.exe | more

The start of the output on my machine is:

Dump of file devenv.exe

PE signature found

File Type: EXECUTABLE IMAGE

FILE HEADER VALUES
14C machine (x86)
4 number of sections
4BA1FAB3 time date stamp Thu Mar 18 12:04:35 2010
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
122 characteristics
Executable
Application can handle large (>2GB) addresses
32 bit word machine

The second to last line is what you are looking for -- if it's there, your executable is large address aware.

How to set IMAGE_FILE_LARGE_ADDRESS_AWARE in cmake?

I use the CMAKE_EXE_LINKER_FLAGS and CMAKE_SHARED_LINKER_FLAGS variables for that, e.g.

if (MSVC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
endif()

Another possibility (modern CMake style) is to set the property of the target, i.e.

if (MSVC)
set_target_properties(MyTargetName PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE")
endif()


Related Topics



Leave a reply



Submit