A Messy Transition: Practical Problems With 32bit Addressing In Windows
by Ryan Smith on July 12, 2007 12:00 PM EST- Posted in
- Software
As we stated earlier, the inspiration behind this article is Supreme Commander, which was crashing during gameplay due to what we discovered to be was the game exhausting its user space. Without taking extreme and convoluted measures, most applications can do little besides (gracefully) crash when they've exhausted their user space. Server applications, which on the whole tend to be the king of memory hogs in the first place, tend to have some sort of compensation mechanism, but for more generalized applications like games this is not the case.
In this case, Supreme Commander was crashing late in to big games on a system that otherwise is completely stable. No amount of testing could come up with a problem outside of Supreme Commander, and most telltale of all was that it was only a problem with large maps with large number of players with high quality settings; turning anything down made the crashing stop. Although not clearly a memory error it greatly reduces the list of possible problems to a few things. The entire process, we suspect, will be similar for everyone hitting the 2GB barrier: the affected application is crashing under heavy load. Thankfully the problem is possible to debug, albeit with moderate difficulty.
With all of that said, I did not come up with the diagnosis or the solution myself and while the problem in retrospect is quite obvious, at the time I did not even take the 2GB barrier in to consideration. As such, credit for the diagnosis and solution belongs to MadBoris of the Gas Powered Games forums who identified Supreme Commander as hitting the 2GB barrier and publishing a solution for it, which we will cover here.
Getting to the root of the problem requires additional tools beyond what comes with Windows XP or Vista. The task manger, the logical tool for this task, doesn't track the information we need to know. At best, the task manager can list how much data is in the various memory pools altogether, however this is not the metric we're looking for. What we actually need to know is how much of the application's share of the virtual address space has been allocated (the fundamental problem after all is when we run out of unused virtual address space to allocate) which due to a multitude of reasons can be much greater than the amount of memory in use by an application. For finding this we'll need Sysinternals' Process Explorer.
The above screenshot was taken as this paragraph was written, showcasing several different memory values for the running processes. The WS Private (Working Set Private) column lists how much physical memory the application is using, and this is the same column listed by the Windows Task Manager for memory usage. The Private Bytes column is the total amount of memory the application is using. Last but not least however is the Virtual Size column, which finally lists the amount of virtual address space allocated, the metric we're after.
We'll quickly focus on Microsoft Word as an example of the discrepancy between physical memory usage and private size. While Word is only using 17MB of physical memory, its virtual size is 170MB, 10 times the physical memory usage and 9 times the total memory usage. This is more or less a worse case scenario but it also points out just how misleading any memory usage - physical or total - is when trying to diagnose this kind of problem. Applications or games with high memory usage tend to not have nearly as a severe spread, but as we can see it's possible for an application to hit the 2GB barrier well before it needs 2GB of physical memory.
Getting to the meat of things however, the process readout for Supreme Commander basically says everything that needs to be said. In order to prove an exaggerated point, we started a 6 player game with 5 AI units on a maximum size map (81km x 81km) and set the game speed to maximum with maximum quality settings, while patching Supreme Commander and adjusting our system configuration to break the 2GB barrier. This actually isn't very playable for a variety of reasons (we'll overtax the CPU quickly due to all the AI units, slowing the game down dramatically) but represents not only what can happen in bad situations, but also is something that happens even in more manageable situations on smaller maps later in to the game.
Just at the start of the game, our virtual size was already in excess of 1.6GB, dangerously close to the 2GB barrier. 16 minutes in to the game, we have already hit a virtual size of 2.2GB, meaning had we not broken the 2GB barrier the game would have already crashed. At this point our total memory usage (private bytes) is only at 1.7GB, with 1.4GB of that in physical memory, nearly maximizing the RAM usage of our 2GB system. Our spread between memory usage and virtual size is .5GB, showcasing how deceptive memory usage is in identifying 2GB barrier issues.
Finally at 22 minutes in to the game, the game crashes as the virtual size has reached the 2.6GB barrier we have reconfigured this system for. Perhaps the most troubling thing at this point is that Supreme Commander is not aware that it ran out of user space in its virtual address pool, as we are kicked out of the game with a generic error message. Unfortunately Windows Vista reverted to a non-accelerated desktop at this point, preventing us from capturing a screenshot of the exact memory readouts or the error message.
69 Comments
View All Comments
johnsonx - Saturday, July 14, 2007 - link
We are both right. While many 32-bit apps run fine on 64-bit windows, some don't. In particular, any app that employs any sort of driver (I'm talking software drivers, not hardware drivers) must at least have the driver compiled in 64-bit mode. In my case the example is a file synchronizing application that installs a driver to monitor file system changes. There are many apps that wouldn't appear to need a driver, but in fact they do. If you want to see the software drivers on your system, go into Device Manager and select Tools->Show Hidden Devices. Now look in "Non-Plug and Play Drivers". Everything in there is a software driver. If you're running 64-bit Windows, everything in there MUST be 64-bit. Applications can also install drivers at runtime, which also must be 64-bit.There are other 32-bit apps that for whatever reason just won't work on 64-bit windows. I believe AutoCAD 2006 and earlier have this problem. Likewise, any apparently 32-bit app that still has some 16-bit legacy code won't run either (for example some rather old but still perfectly useful 32-bit apps use a 16-bit version of InstallShield; the app itself might run, but there's no way to get it installed.).
Regarding the Retail version, I've never had a retail version of Vista in my hand. I recall Microsoft saying at one point that both versions would be on the same disc and had never heard anything contrary.
Christopher1 - Sunday, July 15, 2007 - link
So this 64-bit software driver problem doesn't apply to things like games, I would assume, considering that they usually do not install software drivers?Well then, I think I'm going to contact Toshiba and use their 'Upgrade to x64 version of your operating system' option that recently appeared, if this doesn't effect games.
miahallen - Sunday, July 15, 2007 - link
No, all games should run fine on x64...however, tests have shown that most games run slightly faster on Vista x86.miahallen - Saturday, July 14, 2007 - link
OK you are right, I stand corrected. I knew about this, just wasn't thinking about it. But from my experiance, those particular apps (that use SW drivers) seem to be the ones getting the quickest attention. I do recall having a couple issues related....a freeware plugin for MCE called mymovies. x64 is not supported at all. Also, Daemon Tools & PowerISO were having issues...but I believe they have both been resolved since then (I went to x86 about four months ago, not much point for me to go back until my next upgrade - 8GB RAM).strikeback03 - Friday, July 13, 2007 - link
Somehow I'm doubting that the "average computer user" who buys a prebuilt system without knowing or caring about OS design will stand for random peripherals not working due to a 64bit OS. Probably part of why finding 64bit versions of Vista on prebuilt systems is hard. What should happen is Microsoft state right now that the next version of Windows will be 64bit only; then try and educate consumers that some things won't be compatible, and notify companies that they really need to have their 64bit drivers working by then.jay401 - Thursday, July 12, 2007 - link
No, they should have rendered their units properly (if that's even the real reason... somewhere though they aren't doing something right in their coding, given the way SupCom eats memory).jpeyton - Thursday, July 12, 2007 - link
On page 5, under Software Test Bed, the RAM should read (4x512MB) instead of (4x512GB).fic2 - Thursday, July 12, 2007 - link
First sentence on the front page summary:"As applications being to approach"
I assume that "being" is supposed to be begin.