Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Work around Photoshop's 3GB RAM limit Apps
With RAM prices dropping so fast, it seems a shame that I can't really use more than 3GB of memory for Photoshop. As a 32 bit application, Photoshop CS3 can only "use" 4GB of real memory -- a 1GB chunk for the application, leaving a potential 3GB of real RAM available for Photoshop to use for my images. For anyone with 8GB or more of memory, here's an old concept that tricks Photoshop into using as much memory as you want.

Remember RAM disks from OS9? The feature is available in the command line in OS X. By creating a RAM disk, and having Photoshop use that as the first scratch disk, you'll speed up Photoshop as long as you have enough real memory to do it. For my test, I allocated 3GB to Photoshop in its prefernces (real memory usage), and then created a 2GB RAM disk.

The Terminal command to create a 2GB drive is:
hdid -nomount ram://4194304
The number is the number of 512 byte blocks in your RAM disk. The example above creates a 2GB disk, so a 4GB drive would be 2x that number, and a 1GB drive would be half that number, and so on. Once the disk is created, format it with Disk Utility. Then configure Photoshop to use the RAM disk as your first scratch disk. As soon as CS3 hits the 3GB memory barrier, it starts using the RAM disk as "memory" first. Remember, it will be "swapping" memory pages in and out of the 3GB memory set, but this is still better than swapping to and from a hard drive.

I created a 4.5GB file in Photoshop, and was pleased to see almost no disk activity on my real drive, but my RAM drive was full during my test.

Note: This really only helps someone with 8GB or more of memory running CS3 a lot. For example, if you had 16GB of memory, you could create an 8GB RAM disk, and then allocate 3GB in CS3, effectively having Photoshop "use" 11GB of real memory before hitting the disk. Also note that RAM disks are not quite as fast as regular memory access native to an application, but they are much faster than having CS3 swap to your hard drive.

While it takes some steps to get this configured, I thought there might be some people out there interested in improving how CS3 uses real memory, since there is no 64-bit version yet.
    •    
  • Currently 2.83 / 5
  You rated: 2 / 5 (6 votes cast)
 
[21,244 views]  

Work around Photoshop's 3GB RAM limit | 7 comments | Create New Account
Click here to return to the 'Work around Photoshop's 3GB RAM limit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Work around Photoshop's 3GB RAM limit
Authored by: WildWest on Jul 18, '08 09:19:41AM

This is awesome. I'm going to give this a shot today.

Now this would theoretically work for Illustrator CS3 as well, correct? At least I sure hope so...



[ Reply to This | # ]
Also...
Authored by: WildWest on Jul 18, '08 09:23:59AM

Also, does restarting unmount the ram disk? Or is there a terminal command to unmount when you are finished?



[ Reply to This | # ]
Work around Photoshop's 3GB RAM limit
Authored by: victory on Jul 18, '08 01:22:31PM

Nice hint!

The manpage for hdid includes an example of a shellscript that can be used to create, (HFS+) format and mount a new ramdisk, if it's something that is going to be done frequently (i.e. on startup).

On the other hand, there's also some wisdom in using the Disk Utility GUI as the original hint described -- folks unaccustomed to the cmdline are less likely to trash their system by mistakenly typing in the wrong /dev/disk## assigned by hdid.



[ Reply to This | # ]
Work around Photoshop's 3GB RAM limit
Authored by: bkpr on Jul 18, '08 02:47:49PM

I'm very interested in this hint! However, I don't know much (read: anything) about the command line. What would be very handy for me, is a short step-by-step on creating a RAM Disk in this way. I understand this might be time consuming, so I've a few questions that will hopefully enlighten me…

As I picture it, this hint will create a new mounted disk on my desktop, which I can then assign PShop to use as a scratch disk instead of my second HD.

Questions:
1. Does Disk Utility have a 'RAM Disk' format option, or do I need to select a different format option to create it?
2. After creating the RAM disk with the command line, what does the disk look/act like (before formatting with Disk Utility)?
3. If the final RAM Disk is unmountable, and disappears upon restart, is there a script of some sort that I can use to create/mount it again with a single click, or better still, run automatically at start up? (I have no idea what 'manpage' means :S )

Thanks!



[ Reply to This | # ]
Work around Photoshop's 3GB RAM limit
Authored by: perspixe on Jul 18, '08 04:56:37PM

Peaople have been talking about that for some time, but no serious Photoshop user is actually doing this.
Have you made any tests that conforts you in the fact that Photoshop is actually faster (there are some tests using actions around on the internet). I did some, using the RAM disk or not and didn't notice much difference, and there is a good reason for that.
If you actually watch your RAM use during Photoshop work (CS3 in my case, my OS had always been up to date after testing on a test machine that my work softwares had no issues), you notice that all of the RAM (whether it is 8GB or 16GB or whatever) gets filled as inactive RAM when you work on large images (I work on images from very small up to tens of GB, biggest ever opened and worked on 94GB). This is RAM being actually used but can get free up when another application is open or in need of some. OSX uses this as swap, before writing on disk. So Photoshop first fills its allocated ram, then sends disk io requirements to the OS, the OS fills its RAM with that and then Scratch disks are physically used. This is the simpler way I found to describe this. As it is simple it is not exactly the truth but not far.
I could conclude that making ram disks doesn't allow Photoshop to be faster than letting OSX manages the RAM the way it does.
Also please note that Scratch disks are ALWAYS used. Whatever is done is always mirrored on scratch disk. Available ram just helps by giving head room.
If any doubt go search for Ramon Castaneda's posts on Adobe Forums. He knows all this better than all of us.



[ Reply to This | # ]
Work around Photoshop's 3GB RAM limit
Authored by: styrafome on Jul 19, '08 09:28:45AM

perspixe is correct! This hint is actually 100% unnecessary. Photoshop and OS X already do this on their own. If you have more than 4GB RAM, Photoshop will automatically ask OS X to use unused upper RAM as a scratch disk.

It is all automatic. It can grow as needed, whereas if you make your own RAM disk its size is locked. Let OS X do what it is designed to do for you.

This article explains how it works, with quotes straight from Adobe engineers:

Photoshop CS2 - How Much RAM

One quote from the article:

"We've seen 40% and greater speedups when running tests on big documents that hit the scratch disk by increasing RAM from 4GB to 6GB...What's happening is that Photoshop can only make direct use of about 3.5 GB of RAM on Mac and 2GB on Windows and 3+ on XP 64 bit. But when it goes to write to the scratch file, normally that I/O is done directly from Photoshop's memory to the disk (or vice versa). If you've got more than 4GB of RAM, we let the OS do its buffering thang instead. That is, data is not written directly to the disk; the OS copies it into RAM buffers that reside in that extra RAM Photoshop can't otherwise use."

Tiger is a little buggy about this, so you might need the Force VM Buffering plug-in to make it work. But Leopard seems to have fixed the problem.

Don't bother searching for Ramon Castaneda's posts on the Adobe forums. While he knows about this, he is only repeating documented information from Adobe. Second, every other thread he participates in over there turns into a lengthy, personal flame war thread that you don't want to wade through. Just get your information from the definitive source link above.



[ Reply to This | # ]
Work around Photoshop's 3GB RAM limit
Authored by: perspixe on Jul 19, '08 03:30:59PM

Styrafome, thanks for finding this clear explanation and post it. I actually read it before but could not find it back. I never really noticed about Castaneda's flame but it seems that mention of his name is already creating some. I'll be more careful in the future ;-D



[ Reply to This | # ]