Ned's BigFaT Blog!

April 6, 2007

MEDIC!!!

Filed under: Uncategorized — makfu @ 5:05 am

Okay, so you have a big monstrous new dual or quad core rig with 4GB or more of RAM, a brand new spanking GF8800 and, of course, you are running Vista. Next you decide it’s time to play some BF2142 and shortly thereafter you are sad because BF2142 (along with several other games including the just released S.T.A.L.K.E.R.) crashes frequently with a fault in memory.dll due to an allocation error. Your next reaction is to blame the following: Windows Vista and Microsoft and/or Nvidia/ATI and/or your system’s memory. Well you would be wrong to do so because the real problem has nothing to do with Nvidia drivers, Windows Vista or any hardware: it is the result of the developers not knowing what they are doing.

Specifically this is because the app is attempting larger than 2GB process address space allocations without having the IMAGE_FILE_LARGE_ADDRESS_AWARE bit set in the image header. In order to set this bit, one has to use the /LARGEADDRESSAWARE linker flag when compiling a > 2GB user mode 32 bit application.

So how can one fix this? The good news is there is a utility included with Visual Studio named EditBin that can modify the image header and set the IMAGE_FILE_LARGE_ADDRESS_AWARE bit. If you have VS2005, simply copy the problem executable and from the command prompt run “editbin /LARGEADDRESSAWARE BF2142.EXE”, replacing BF2142.EXE with the problem exe you need to fix. Then simply copy your fixed exe over the original provided by the ISV. Alas, if you don’t have VS2005, you are out of luck, but since this issue has become better understood, you should be able to search the Internet and find a packaged copy of EditBin with the necessary DLL’s (I can’t provide said utility for obvious reasons).

Once you have set this bit, if you are using 32bit Vista you should also enable large process address space support. You can do this by typing “BCDEDIT /Set IncreaseUserVa 3072” at an elevated command prompt (you will obviously need to reboot). Keep in mind this is not a supported configuration for 32bit Vista and could lead to other issues; if it does enter “BCDEDIT /Deletevalue IncreaseUserVa” to remove the large address space support. To avoid this, use Vista x64 as it supports the entire 4GB of 32bit address space for use by the process right out of the box.

In the meantime, I have posted a fixed version of the BF2142.exe here: ftp://ntpbox1.ntpower.com/bf2142lafix.zip

If you need an app you think is having the problem (S.T.A.L.K.E.R. and BF2142 are the two big culprits at the moment) drop by #msvista on EFNet and ask me (MakFu) for some help. Also, feel free to e-mail the ISV’s in question and ask them WTF?!

Blog at WordPress.com.