May 26, 2005

Memory allocation and usage (Photoshop CS2)

Source: Photoshop Support Knowledgebase

How Photoshop allocates RAM

When Photoshop starts, it allocates, or sets aside, a portion of RAM, the size of which is based on the amount that is designated in the Photoshop Memory & Image Cache preferences. While this RAM is reserved for Photoshop processes, it may be used by other applications when it isn’t actively in use by Photoshop, and is released when you quit Photoshop. The default RAM allocation settings are 70% for Mac OS, and 55% for Windows. These settings should be optimal for most users. To get the ideal RAM allocation setting for your system, change the RAM allocation in 5% increments and watch the performance of Photoshop in the Performance Monitor (Windows) or the Activity Monitor (Mac OS). You must quit and restart Photoshop after each change to see the change take effect.

The available RAM shown in the Memory & Image Cache preferences already deducted an amount that is reserved for the OS at any given time from the total RAM in your machine. You shouldn’t set the percentage of RAM to be used by Photoshop to 100%, because other applications which run at the same time as Photoshop (for example, Adobe Bridge) need a share of the available RAM. Some applications take use more RAM than you might expect. For example, web browsers can use 20-30 MB of RAM, and music players can use 20-50 MB RAM. Watch the Performance Monitor or the Activity Monitor to view the RAM allocations on your computer.

Watch your efficiency indicator while you work in Photoshop to determine the amount of RAM you’ll need to keep your images in RAM. The efficiency indicator is available from the pop-up menu on the status bar of your image and from the Palette Options on the Info Palette pop-up menu. When the efficiency indicator goes below 95-100%, you are using the scratch disk. If the efficiency is around 60%, you’ll see a large performance increase by changing your RAM allocation or adding RAM.

New capabilities with 64-bit processors

Photoshop CS2 is a 32-bit application. When it runs on a 32-bit operating system, such as Windows 2000, Windows XP Professional, and Mac OS v10.2.8, it can access the first 2 GB of RAM on the computer.The operating system uses some of this RAM, so the Photoshop Memory Usage preference displays only a maximum of 1.6 or 1.7 GB of total available RAM. If you are running Windows XP Professional with Service Pack 2, you can set the 3 GB switch in the boot.ini file, which allows Photoshop to use up to 3 GB of RAM.

Note: The 3 GB switch is a Microsoft switch. Contact Microsoft for instructions and troubleshooting this switch. You can search on the Microsoft support page for 3gb for information on this switch.

When you run Photoshop CS2 on a computer with a 64-bit processor (such as a G5, Intel Xeon processor with EM64T, AMD Athlon 64, or Opteron processor), and running a 64-bit version of the operating system (Mac OS v10.3 or higher, Windows XP Professional x64 Edition), that has 4 GB or more of RAM, Photoshop will use 3 GB for it’s image data. You can see the actual amount of RAM Photoshop can use in the Maxiumum Used By Photoshop number when you set the Maximum Used by Photoshop slider in the Memory & Image Cache preference to 100%. The RAM above the 100% used by Photoshop, which is from approximately 3 GB to 3.7 GB, can be used directly by Photoshop plug-ins (some plug-ins need large chunks of contiguous RAM), filters, actions, etc. If you have more than 4 GB (to 6 GB (Windows) or 8 GB (Mac OS)), the RAM above 4 GB is used by the operating system as a cache for the Photoshop scratch disk data. Data that previously was written directly to the hard disk by Photoshop, is now cached in this high RAM before being written to the hard disk by the operating system. If you are working with files large enough to take advantage of these extra 2 GB of RAM, the RAM cache can speed performance of Photoshop.

Virtual memory and the Photoshop scratch disk

Photoshop CS2 may allocate more memory (RAM and scratch disk) to itself when starting than earlier versions of Photoshop, depending on the amount of RAM on the computer and the percentage of RAM allocated to Photoshop in the Memory Usage preference. The amount of available RAM on the system also dictates the image tile size in Photoshop (Photoshop uses tiles to redraw images in sections).

Photoshop displays RAM and scratch disk usage and allocation in the Scratch Sizes section of the image’s status bar or the Info Palette. The number on the left indicates the RAM used and scratch disk space allocated to Photoshop The number on the right indicates the amount of RAM that Photoshop can use for image storage or scratch disk. Thus, the number on the left may be larger than what you are accustomed to from previous versions, but does not indicate that images use three times more RAM than they did in previous versions.

If the percentage of RAM allocated to Photoshop is too high, both the operating system and Photoshop can swap pages out of RAM, causing slow performance in Photoshop. Page swapping is a normal operating system function that only affects performance when the amount of RAM that Photoshop and the operating system are trying to use is more than the total amount of RAM on the computer.

If you have more than one hard disk, you’ll get the best performance when virtual memory is on one hard disk and the Photoshop scratch disk on another, so they do not try to use the hard disk at the same time, which can slow down Photoshop and the operating system. However, if the operating system has enough RAM to not have to swap pages out of RAM, then having virtual memory and the Photoshop scratch disk on the same drive will not decrease performance.

Determining how much scratch disk you need

With changes in Photoshop and its memory management, the formula used in the past (that is, 3-5 times the size of your average image) no longer provides an accurate estimate of how much scratch disk Photoshop needs. In Photoshop CS2, you can use the states in your history palette to help you determine how much scratch disk space you need.

Each history state that includes an operation that affects the entire image (for example, when you apply Gaussian blur or unsharp mask to the entire image) creates a full copy of your image at its original size. If your initial image is 500 KB, and you apply Gaussian blur to it, your image will need 1 MB of scratch space. If your history states consist of operations that affect only part of the image, such as paint strokes, only the size of the tiles touched by the strokes are added to the image size. If you count up the number of histories you have where operations have affected the entire image, and multiply your original image size by that number, you’ll have an approximate amount of scratch disk space the image will need. If you have applied levels, a reduce noise filter, and an unsharp mask filter to your entire image that’s 5 MB in size, the image will need 20 MB of scratch space.

If you need to reduce your scratch disk overhead to a minimum, you can minimize the number of patterns and brush tips you use in each as your presets, and you can reduce the number of patterns you use in your image’s Layer Styles (as applied with the Bevel and Emboss Texture or in the Pattern Overlay). Each small pattern and sampled brush in the presets uses at least one tile for storage. Patterns used in Layer Styles take extra RAM, as well.

Out of memory errors

Camera Raw, as well as other plug-ins and filters in Photoshop, use large contiguous chunks of RAM, sometimes up to 100 MB per image. You may see out of memory errors when these plug-ins cannot access enough contiguous RAM because you don’t have enough RAM or the RAM is too fragmented.

If you occasionally get out of memory errors, restart Photoshop to defragment your RAM. If these errors occur frequently, decrease the memory slider in Photoshop in 5% increments to see if giving less memory to Photoshop allows Camera Raw and other filters and plug-ins the amount of contiguous RAM that they need.

Maximum file, hard disk and scratch disk sizes

Photoshop CS2 has constraints on file sizes. The following are the maximum file sizes in Photoshop CS2:

– For PSD: 4 GB

– For TIFF: 4 GB

– For PSB: 100 GB

– For PDF: 10 GB, 30,000 pixel limit is in effect, and pages are limited to a maximum size of 200 inches.

Photoshop CS2 should be able to run on any size hard disk that’s supported by your operating system, such as 4 Terabytes.

Photoshop CS2 can access 64 Exabytes of scratch disk space.

Adjusted Refresh plug-in

The amount of space set aside for and displayed in the Scratch Sizes indicator in Photoshop CS was much larger than in earlier versions because the tile sizes were larger. The Adjusted Refresh plug-in reduced the initial scratch disk usage when you started Photoshop, and reduced the size of the Photoshop image tiles from the default size of 1 MB per tile to 64 KB per tile. The smaller tiles allow the display to redraw in smaller pieces, reducing the time needed to preview some filter updates. This plug-in is not necessary for Photoshop CS2, because the new maximum tile size in Photoshop CS2 is 132 KB.

Bigger Tiles plug-in

The Bigger Tiles plug-in, which is located in the Applications/Adobe Photoshop CS2/Plug-Ins/Adobe Photoshop Only/Extensions/Bigger Tiles folder (Mac OS) or Program Files\Adobe\Adobe Photoshop CS2\Plug-Ins\Adobe Photoshop Only\Extensions\Bigger Tiles (Windows) is disabled by default. When you enable it by removing the ~ from the filename, then you increase the image tile size in Photoshop. You should only enable the plug-in if you have more than 1 GB of RAM installed.

If you enable the plug-in, then Photoshop redraws more data at a time because each tile is larger, and each tile is drawn, complete, at one time. Photoshop takes less time to redraw fewer tiles that are larger, than more tiles that are smaller. Because Photoshop redraws more data at one time, each tile it takes longer to be redrawn; so bigger tiles can look like they are redrawing slower, but they are actually redrawing faster than if the image had more smaller tiles.

Read original tech document

Read related document Improve performance in Photoshop CS2 on computers with more than 1 GB RAM

Read the PSN article Photoshop CS2-How much RAM? – Fact

Comments are closed.