Saturday, October 13, 2007

Limitasi Memory hanya 1.5GB pada Blender3D oleh Windows

0. You are using Windows 2000, 32bit XP, or 32bit Vista.
1. You are working with complex scenes that take up 1GB RAM or more.
2. You have more than 1GB of physical RAM. If you have less RAM, you'll run into other problems long before you have to worry about this.
3. Blender crashes unexpectedly when the RAM usage reaches about 1.5GB.

This article is NOT for you if:

1. Yours scenes are relatively simple and take up less than 1GB of RAM at any given time.
2. You have very little physical RAM (Less than 1GB).
3. Blender crashes for other reasons, ie unstable video drivers, software conflict...

The problem:

Basically 32bit Windows is designed so that ANY SINGLE application can only utilize up to 2GB of RAM. Realistically, the maximum amount of RAM a program can use before it crashes is around 1.5GB. 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, memory usage can easily reach 1.5GB+. Without proper configuration, Blender crashes.

View of the Task Manager (Ctrl+Alt+Delete) when blender is in a 'healthy' state.

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:

The Solution for 32bit Windows:

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"

With this switch, your computer will allocate 3GB to applications. Reboot your computer for the change to take effect.

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


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

Find a version of Blender that is compiled with the LAA (Large Address Aware) flag. 'Official' Blender releases are not compiled with LAA. But this one does: Here is the clean Blender 2.45 compiled with the LAA flag. LAA blender requires the /3GB flag to be used, as described above. Without the /3GB flag, LAA blender behaves normally just like any other Blender release.

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 this article?
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 using close to 2GB of total memory, which would be painfully slow (due to the performance hit of using the swap file) that most users would just think their computer has 'froze' and hit the reset button.

Q: What about 64bit Blender?
A: Using the same 32bit LAA Blender 2.45 on 64bit Windows can give you 4GB of available RAM space per application to work with, once 64bit Blender is out, this number will probably go up to 8TB on 64bit Windows.

Q: What about Linux or OS X?
A: To the best of my knowledge, 32bit Linux, has this memory wall at around 3.5GB or so. I am not sure about OS X. (comments would be appreciated) Edit: Thanks Tux Runner

Q: So this fix completely solves the problem?
A: No. To quote jlh on blendernation, this fix just relocates the problem from 1.5GB to 2.5GB and linux will probably not go higher than 2.5GB either. All in all, it boils down to: 32-bit systems are starting to hit their limits. And it's no different with linux. 64bit is a mandatory upgrade once program starts using more than 4GB of memory.

Q: My computer is running funny with the "\3GB" switch
A: The DirectX 9 API has issues with the 3GB flag, thus rarely some older games experience problem when ran under the 3GB flag.

Summary

General memory limits32-bit64-bit
Virtual 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 /LARGEADDRESSAWARE switch
Virtual address space per 64-bit processNot applicable8 terabytes