Feb 222012
 

What’s LARGEADDRESSAWARE?

32 bit processes are by default confined to a 2 GB address space even though a 32 bit address can address up to 4 GB of memory. Remaining 2 GB goes to the Windows Kernel. With LARGEADDRESSAWARE we can bypass this limitation to an extent, this switch will enable a 32 bit process to address up to 3 GB of virtual address space.

The downside of this feature is that Kernel components will be restricted to 1 GB of virtual address space. We advise developers to use this switch only on server machines where just one dedicated application is set to run, for e.g. SQL Server. Its not great to halve kernel memory space on a machine with too many user mode applications or device drivers running in tandem as there will be demand for higher amount of kernel memory.

On Windows XP, some drivers, especially video adapter drivers with onboard RAM, cannot run with the /3GB parameter because they require more address space than the 1 GB kernel address space permits.

While on a 64 bit machine, considering the vast expanse of memory available to us, LARGEADDRESSAWARE flag is turned on by default for a process this way a 32 bit process gets the entire 4 GB address space on a 64 bit machine. Well known desktop 32bit applications like Visual Studio has this switch enabled because most of the new machines we purchase are 64 bit machines and this way Visual Studio benefits automatically. This switch is harmless on a 32 bit machine which doesn’t have /3GB OS switch enabled.

How to enable LARGEADDRESSAWARE?

Application

The command to enable large address aware is as follows…

EditBin /LARGEADDRESSAWARE NotePad.exe

How to check if the above command worked or not? Run the above executable (in our case NotePad.exe) with DumpBin.exe.

C:\> DumpBin /Headers NotePad.exe

FILE HEADER VALUES
14C machine (x86)
4 number of sections
4BA1DC16 time date stamp Thu Mar 18 02:53:58 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

See highlighted line.

Changes to boot.ini

Please add /3GB switch as shown below to a boot entry that you’d like to configure…

multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Windows Server 2003, Enterprise" /fastdetect /3GB

  3 Responses to “How to enable LARGEADDRESSAWARE?”

  1. Hi Nibu,
    I have a query related to it. When I build my .Net application (Class Library Project) in Visual Studio 2017, LargeAddressAware is enabled and verified it by using dumpbin. When I run my CI job on same application using jenkins then I found that LargeaddressAware is disabled. Please tell me the reason of it.

    If there is any way to set LargeAddressAware Programmatically then let me know.

  2. Hi Nibu,

    One doubt, what was the purpose of having the LARGEADDRESSAWARE flag in a 32 bit environment. No matter the flag is specified or not, in a 32 bit process, the pointers will be capable of handling 2^32 addresses right? But of course the upper 2B is reserved for kernel. Are you saying that even if I start the OS with /3GB switch, my application cannot use the memory after 2GB unless this flag is specified?

    • Hi Naveen,

      >> One doubt, what was the purpose of having the LARGEADDRESSAWARE flag in a 32 bit environment. No matter the flag is specified or not, in a 32 bit process, the pointers will be capable of
      >> handling 2^32 addresses right?
      LARGEADDRESSAWARE enables an application to use 3GB memory which is within limits of 2^32 (4GB).

      >> Are you saying that even if I start the OS with /3GB switch, my application cannot use the memory after 2GB unless this flag is specified?
      The flag tells the OS to increase user mode address space by 1 GB and make it 3GB and make kernel mode 1 GB, but this can cause issues with applications which hasn’t ‘requested’ for a larger address space. Hence the designers chose to allow only those applications to see the extra 1GB space which has requested for the extra space. So how to request for this space: via LARGEADDRESSAWARE flag which in turn adds IMAGE_FILE_LARGE_ADDRESS_AWARE to the image header.

      So what happens to the applications which hasn’t requested the extra 1GB space? They continue to use 2GB, the 1GB remains invisible to the app, which means the memory is wasted. Why is it wasted? Neither kernel nor the user mode app is using it.

      LARGEADDRESSAWARE and /3GB work in tandem. Its good for server machines which run SQL server or other heavy apps. Sometimes good with Visual Studio which loads a huge number of projects.
      Thank you,
      Nibu

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.