Blender, Memory issues, and 64bit (For Windows)

This article is for you if:

  1. You are using Windows (2000, XP or Vista)
  2. You are working with complex scenes that sometimes take up 1GB RAM or more. And Blender crashes for no apparent reason.
  3. You have more than 1GB of physical RAM. If you have less RAM, you'll run into other performance problems long before you have to worry about this.
XP memory usage
View of the Task Manager when blender is in a 'healthy' state.

Terminology

Addressing Space can be seen as the maximum amount of memory and virtual memory the operating system can utilize. It is independent from the actual amount of RAM a computer has. For 32bit Operating System, the total Addressing space is ALWAYS 4GB, or (2^32 bytes). For 64bit, this number is a lot bigger: about 16000000Terabyte.

The problem:

Basically 32bit Windows is designed so that EACH application can only utilize up to half of the 4GB addressing space, or 2GB. (the other half is reserved for the system). Again, this is a software limit inherent to the architecture of the operating system, and has nothing to do with how much RAM is actually installed. This does not cause a problem for day-to-day applications because they usually stay well below this limit. But when working with Blender, especially baking fluids, or rendering high resolution images with composite node, a single application can easily reach 2GB of memory usage. From my testing, without proper configuration, Blender crashes at the 1.5GB mark.

Remember this is a software limitation due to the design of Windows, you can install 4GB of physical RAM on your computer, and set-aside a 4GB swap file, Blender will still crash at the 1.5GB mark. Thankfully there is a fix for the problem:

Solution for 32bit Windows (Vista, Server 2008)

For 32bit Vista users only: Setting the '3GB' Flag in 32bit Windows Vista


Solution for 64bit Windows(XP x64, Server 2003 x64, Vista x64, Server 2008 x64)

64bit Windows users, read the FAQ at the bottom. You do not need the '/3GB' Flag.

Solution for 32bit Windows (2000, XP, Server 2003):

This is a two step procedure. We will raise the memory limit Windows allocate to each application from the default 2GB to 3GB. This way, our favorite application (blender?) can effectively use about 2.5GB of RAM for itself(a significant increase from the default 1.5GB). And here is how we do that in Windows 2000/XP:

Warning: Editing boot.ini could cause your computer to become unbootable. If you are unsure of what you are doing, do some research before continuing.


Step 1.

1. Right click on My Computer, Click Properties, go to the Advanced tab, click on Settings under Startup and Recovery, click on Edit in the new window that pops up, boot.ini should open in notepad. Now, find the line that looks like this:

multi(0)disk(0)rdisk(0).....="Windows XP" /fastdetect


Append this 5 characters to the end of the line, without the quote: " /3GB" xp boot.ini
With this switch, your computer will allocate 3GB to applications. Reboot your computer for the change to take effect.

Step 2: (For all 2000/XP/Vista users)

Once you have completed step 1, find a version of Blender that is compiled with the LAA (Large Address Aware) flag. The LAA flag tells the Windows operating system that the application is aware and capable of handling the extra large address space. 'Official' Blender releases are not compiled with LAA. But this one does.

Step 3: There is no step 3

So that's it. With the above 2 steps, your Blender should be able to render fluids at resolution 500 and render still images at 3200x2400 without any problem. Remember, /3GB and LAA need be used together for this trick to work.

FAQ

Q: I only have 1GB of physical RAM (or less), should I worry about LAA and /3GB?
A: The short answer is no. It is unlikely that you will truly hit the 1.5GB barrier, since the OS takes up some memory as well, by the time Blender is using 1.5GB of RAM, your computer is probably going very slow, due to the performance hit of using the swap file.

Q: What about 64bit Blender?
A: There is no 64bit Blender for Windows yet. But using any 32bit LAA Blender on 64bit Windows gives you 4GB of addressing space!

Q: So this fix completely solves the problem?
A: No. this fix just relocates the problem from 2GB to 3GB, and in the case of 64bit Windows, 4GB. All in all, it boils down to: 32-bit systems are starting to hit their limits. And it's no different with linux or OS X. 64bit is a mandatory upgrade once artists starts using more than 4GB of memory.

Summary

General memory limits32-bit Windows 64-bit Windows
Address space per 32-bit process2 GB, 3 GB if the system is booted with the /3GB switch and application is LAA2 GB, 4 GB if the application is compiled with the LAA switch
Address space per 64-bit processCan not run 64bit program on 32bit operating system8 terabytes

Related:

64bit Blender myth [link]



Comments



A Mike Pan Design.