Windows Memory Usage

OPUS/UrbanSim requires a lot of memory to run, particularly with large databases like the one for the Puget Sound region. We have had difficulty getting UrbanSim to run on Windows machines at times, even those with large amounts of RAM (e.g. 4GB). This page details how to get Windows to allocate more memory to Python processes. This technique has allowed us to run UrbanSim for the Puget Sound region on Windows machines with 4GB of RAM. This web page sums up some of Microsoft's information on this topic nicely: http://www.winhlp.com/node/73

WARNING: This requires modifications to be made to sensitive OS files. Make these changes at your own risk.

Modify boot.ini

A /3GB switch needs to be added to this file. This is a hidden OS file usually found in the root of the system boot drive (almost always c:\). Here is a sample of what this file could look like with the switch added. Do not copy this text directly, this is only for sample purposes. It is recommended that you back up this file before modifying it. Also, boot.ini is typically located in the root of your main boot drive (usually c:) and is a hidden file by default. You may have to enable the viewing of hidden files in order to modify it. One way to see it is to go to Start>Run then enter (without quotes) 'notepad c:\boot.ini' which should bring up the file in notepad for editing. It is still recommended that you back this file up first.

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /3GB

Modify python.exe

In order for the above modification to have any effect, it must be combined with this modification to enable a specific application to use more memory. You will need Visual C++ in order to do this. If you do not already have this, then you can download a free version from Microsoft: Visual C++ Express Edition. Once you have Visual C++ installed, follow these steps.

  • Make a backup copy of python.exe
  • Add the path containing mspdb80.dll to your PATH environment variable. The default path is: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE or you could try searching for the mspdb80.dll file to find the path
  • Open a command window, then switch to the directory containing editbin.exe. The default path is: C:\Program Files\Microsoft Visual Studio 8\VC\bin or you could try searching for the editbin.exe file to find which directory to switch to
  • Once you have a command window open to the appropriate directory, modify python.exe by entering:
editbin /LARGEADDRESSAWARE c:\Python25\python.exe
  • Your python.exe file should have a new modified date if it worked correctly
  • Reboot for the changes to take effect