Link 32-Bit Native C++ EXEs with /LARGEADDRESSAWARE

If you’re not running a 64-bit version of Windows, I bet that at least one of your customers is. While you should be working on porting your native applications to 64-bit, it doesn’t look like that many teams have made that step. While it will take effort and testing to make the switch, you can make a small change to your 32-bit builds that will provide a big benefit when running on x64: more memory!

All you need to do is add the /LARGEADDRESSAWARE to the linker for your EXE and when your 32-bit EXE is run on a 64-bit system, it will have a 4GB address space instead of the default 2GB address space normally associated with 32-bit applications. As with any switches like this one, you will need to test your application on the 64-bit machine to ensure you don’t have problems. If you are using the high bit of pointers addresses or subtracting pointers that are not from the same object, setting /LARGEADDRESSAWARE will cause a serious bag of hurt.

To turn on /LARGEADDRESSAWARE, go into your EXE project properties, Linker, System and set the Enable Large Address field:

To show you the benefit of the /LARGEADDRESSAWARE switch, I created a simple EXE application that allocated and committed 50 MB every time you clicked a button and popped up a message box when the allocation failed. Without the /LARGEADDRESSAWARE switch set, here’s what Process Explorer reported for Private Bytes and Working Set when running on Vista x64:

After turning on the /LARGEADDRESSAWARE, here’s how much memory the application was able to use on x64:

If you’re curious, the exact same EXE with /LARGEADDRESSAWARE set runs perfectly fine on normal 32-bit machines. For those of you wondering what affect this has with the /3GB boot switch for the operating system, read more about the /3GB here.

While some people are taking /LARGEADDRESSAWARE to interesting extremes, it’s definitely something that anyone building 32-bit EXEs should be looking at. However, as I said before, don’t just flip it on and ship, you do need to test on x64 machines to ensure you or any libraries you use don’t do stupid things with pointer addresses.

Copyright © 1995 – 2018, Atmosera, Inc. All rights reserved.

The following legal and privacy policy cover Atmosera, Inc. and its doing business as (dba) EasyStreet Online Services.

Atmosera is a registered trademark of Atmosera, Inc. Certain names, logos designs, titles, words or phrases on this site may constitute trademarks, servicemarks or tradenames of Atmosera or other entities, which may be registered in certain jurisdictions.

Privacy Policy

  • Atmosera is committed to respecting your privacy.
  • Once you choose to provide personally identifiable information, it will only be used in the context of your relationship with Atmosera.
  • Atmosera will not give, sell, rent or lease your personally identifiable information to others unless required by law or your prior permission is obtained.

Acceptable Use Policy

This Acceptable Use Policy (the “AUP”) applies to the use of the services of Atmosera and its affiliated companies (“Atmosera”) by its customers (the “Services”). This AUP supplements, but does not supersede, the agreements that customers or other users (“You”) have with Atmosera. The AUP also applies, and should be communicated, to each Atmosera customer’s own customers and/or end users that utilize the Services provided through the Atmosera customer. In the event of any conflict between a customer’s agreement and the AUP, the AUP will govern. By using the Services, you agree to the latest version of this AUP. Please read it carefully.

Atmosera has published this AUP to help ensure that the Services provided to our customers are of the highest quality, and to help protect the privacy and security of our customers, systems, and networks, while also encouraging responsible use, including compliance with applicable laws. Additionally, the AUP describes types of use of the Services that are prohibited. Atmosera may at its sole discretion determine whether a use of the Services is a violation of the AUP. Atmosera in no way intends to monitor, control, or censor communications or content that a customer may acquire, transmit, or store on or via Atmosera’s network. However, when we have knowledge of a violation of this AUP, we reserve the right to take such action as is necessary to address the violation, as referenced below.

Definitions

As used herein, “Content” shall mean all information made available, displayed, transmitted or retransmitted in connection with customer’s use of the Services (including, without limitation, information made available by means of a “hot link”, a third party posting or similar means) including all trademarks, service marks and domain names contained therein as well as the contents of any bulletin boards, social sites or chat forums, and, all updates, upgrades, modifications and other versions of any of the foregoing.

Illegal/Criminal Activity

The Services may not be used in connection with any criminal or civil violations of local, state, provincial, federal, or international law, treaty, regulations, court order, ordinance, administrative rule, or other government requirements.

Intellectual Property

The Services may not be used to transmit, re-transmit, host or store any Content or to engage in any activity that infringes or facilitates the infringement of the intellectual property rights or privacy rights of any individual, group or entity, including but not limited to any rights protected by any copyright, patent, trademark, trade secret, trade dress, right of privacy, right of publicity, moral rights or other intellectual property right now known or later recognized by statute, judicial decision or regulation.

Threats

The Services may not be used to transmit, re-transmit, host or store materials or Content that is of a threatening nature, including threats of death or physical harm, or that is harassing, libelous, and or defamatory, invasive of privacy rights, or to provide information or assistance in causing or carrying out violence against any government, organization, group or individual.

Spam

Spam is an unacceptable use of the Services and is a violation of the AUP. Prohibited acts include, but are not limited to, any of the following activities:

  • Posting a single message or messages similar in content, to more than five online forums or newsgroups.
  • Posting of messages to online forums or newsgroups that violate the rules of the forums or newsgroups.
  • Collecting the responses from unsolicited email.
  • Sending any unsolicited email that could be expected, in Atmosera’s sole discretion, to provoke complaints.

Indirect Access

A violation of this AUP by someone having only indirect access to the Services through a Customer or other user will be considered a violation by the Customer or other user, whether or not with the knowledge or consent of the Customer or other user. In addition, this AUP applies to any email or Content transmitted by a customer or on its behalf using a Atmosera account as a mailbox for responses or promoting Content hosted or transmitted using the Services, or indicating in any way that Atmosera was involved in the transmission of such email or Content.

Stay Informed

Sign up for the latest blogs, events, and insights.

We deliver solutions that accelerate the value of Azure.
Ready to experience the full power of Microsoft Azure?

Atmosera is thrilled to announce that we have been named GitHub AI Partner of the Year.

X