A Good Day

Photoshop pushes a machine harder than most programs. It’s part of squeezing out as much performance from a machine as possible. Sometimes that means marginal hardware can show problems that look an awful lot like software bugs but aren’t. Or, even worse, cause a machine to mysteriously reboot (it’s happened). In other words, we take performance seriously, but that can sometimes tickle machine weaknesses.

So, as we’ve heard the occasional reports of mysterious pauses or bad slowdowns with CS2, we have really been paying attention. Trying to find a reproducible case can be very hard, though – and it’s hard to fix a performance issue if you can’t reproduce it (or at least have enough information to simulate it). And sometimes, through the course of dealing with a helpful user, it can become clear that there is something very weird or particular about the machine they have, and boy, at that point, do you really want to get your hands on that machine and take a good, deep look.

Well, through a series of events, we got lucky enough to find a user in the local area with a slowdown issue. So Seetha and I packed up his laptop in the car and headed out yesterday afternoon. When we got there, our user was so happy to have us.

We started with a demonstration of the problem. It took a while to happen. But when things started going “funny”, it was pretty clear that something was not normal. Ah, good, we thought. Not intermittent or one of those funny bugs that can simply disappear when two senior engineers walk in the room (you’d be surprised at how often *that* happens), but a repeatable problem that just happened to be tied to a specific machine.

I had us do the thing I always do when starting to try and figure out a bug – we pulled up Performance Monitor (on a Windows box – I pull up Activity Monitor on Macs, or install X Resource Monitor) and repeated the problem. Our user once again showed us the problem as Performance Monitor was watching CPU, disk activity, and free RAM. I have a set of colors I tend to use for these things, so that I can glance at Performance Monitor and know quickly what is going on. So we tried to reproduce the problem quickly. And the lines in Performance Monitor looked OK. So we sat back to think about what things might be going on – and after a short bit, I noticed that the blue line I use for free RAM was making a steady march downwards. With Photoshop idle. Ugh. And we watched the memory go to near-zero, at which point disk activity started going up, and we started poking around, and it now became clear why performance on this machine was getting so bad so quickly – a memory leak. A bad one. One that we had never seen before. So now the hunt was on for why…

We started up Task Manager and went to the Performance tab. Yup, available RAM was sitting at 3MB. On Windows XP, if your machine every has less than about 15MB of free RAM, you know you’re going to be in for trouble performance-wise. Ugh. So we quit Photoshop – which took a bit, since there was so much of Photoshop paged out due to the leak. I switch Task Manager to the Processes tab, added Virtual Memory Size, and started Photoshop, and didn’t touch it. Yup, there, plain as day. Munch, munch, munch went memory.

We did some first-step debugging – restarting without plug-ins, without scripting. No good. Still leaking memory. With all the easy answers gone, we hooked Seetha’s laptop up to our user’s network, installed the remote debugging stubs on the user’s machine, and started up a debug build. When the debug build started up, with all of it’s extra asserts and checks and paranoia built in, the smoking gun showed up right away. Aha. Bad font. And the light bulb went off in my head… The font preview menu. You see, I implemented the font preview menu to take absolutely zero extra time at startup. It generates all the previews on the fly, in the background, at idle time. Works really well, especially as most machines can read in a font and generate a preview just about as fast as they could read in a cache. We can usually generate all your previews in the first 20 seconds or so while the app is up, while some other programs that have WYSIWYG menus take more than twice as long to read in their cache.

Anyway, it matched the idle-time symptom of the memory leak we saw. And it struck me that if – **if** – a font failed in a certain way that caused our font rasterizer component to let the failure leak out (which isn’t supposed to happen) we could not only drop our memory on the floor but not remember that we tried that font. Bad news. So, we tried the workaround of turning off the preview menu, and of course, no memory leak. Now, both Seetha and I are eager to figure out which font it is, so we can bring the sucker back with us and dissect what went wrong. So, we bring up the debug build again, catch the problems, read the indicators, and get the font name. Cool. We turn on the preview menus and remove those fonts from the system, and start Photoshop and watch. Shoot. The memory leak is still happening. Seetha posits that it could be more than one font. So, we start a full-on search for the bad font (yup, the very same binary search-for-the-bad-font that we ask users to do when we suspect the problem is related to a bad font). Sure enough, with nothing but the minimal font set installed, Photoshop starts up fine – no leak. So we start moving fonts back, chunks at a time. No leak. We move more No leak. We’re back down to the one font we thought was bad, and moved it back. No leak. Huh?

At this point, we’ve actually completely solved the user’s problem with no workaround (all their fonts are back in place and the program is performing great). And we have enough information to simulate the bug back in the lab (which I’ve now done). So we pack up and head out, thanking our user for their time (I hope we conveyed how immensely we appreciated it – we really did). Our best guess is that some pre-caching or performance mechanism in the operating system somehow got a bad shadow copy of the font and that bad shadow copy was causing the issue, and that re-installing all the fonts (which is what we essentially ended up doing) force the bad shadow copy to be refreshed from the good copy. But that’s a guess.

Now, while I’d really like to know what actually went wrong, we ended the day with a happy user, information that might help some other users, and a cornered bug to be fixed for the next release. And both Seetha and I reflected on our way back to Adobe about all the bad software we deal with and programmers who wouldn’t even think of going to a user’s site to debug an issue (and certainly not 2 senior engineers like us).

A good day.

-Scott

38 Responses to A Good Day

  1. Ben Reilly says:

    Thank you for this post! I knew we’d been having problems with CS2 being incredibly slow, but had not thought about checking out the fonts.

  2. Rob Dodson says:

    Great story. It’s very reassuring to know that you all work so hardto squash the bugs. Fonts can causehavoc! I had a font that was fine in all regards until I installed CS2. None of the CS2 apps would start until I turned off the font. I know that the font code is pretty robust in CS2, but it just seems like a bad font should not be able cause a total abort.Anyway thanks for the great work.RobPS. if you want the font let me know.

  3. Ken Pratt says:

    Hi Scott,Well done and it is very good to see Adobe getting close to the customer.We have seen so many stand offs on the forums it seemed that customers were trying their best to provide useful information but it was never going to be enough to solve the problem. I could see this was never going to be fixed unless you experts went to see a system with a real problem.Adobe would get so much credit if you made the fix a free dot release and did not make customers wait for CS3.Best regards,Ken Pratt

  4. Scott Byer says:

    Note that this wasn’t the first customer visit done by Photosohp engineering to get to a customer machine showing slowdowns – but it was the first I had a chance to go on this cycle, and was the first real successful one this cycle.A bug like this, with easy workarounds, doesn’t usually contribute to the overall weight behind a maintenance release. The decision to do a maintenance release is a complex one involving many factors, and while I have input into that process, it isn’t my decision and doesn’t always go my way.-Scott

  5. Christine Krof Shock says:

    Scott,What I find interesting is that so many people get mad at Adobe without checking either the forums or checking their system.Every time that I have called the customer service line, the techs have been helpful and have gone the extra mile.(not like that page layout software company in Denver who always states that it’s Microsoft’s problem when their software starts misbehaving…)When we installed CS2 in my former lab, we knew that we were installing it on minimum spec machines (no video card, just a controller chip,496 of RAM with 16 bits being shared by the controller chip) and we really anticipated problems with CS2 (in hopes of finally getting new machines)…guess what…no problems. However, these machines had received a clean install of XP, reformatted/defragmented hard drives and a clean install of all fonts and software.It’s not easy or fun, but we do it every semester because these are machines that are going to be beaten up for 12 to 16 hours a day by students and faculty.Guess the new machines will have to wait for Vista to arrive…

  6. Timur says:

    Hello!I’ve encouterred the problem exactly you’ve described, but manipulations with fonts don’t makes any effect. Could you give a explanation or link to how can I determine exactly what font causes memory leak?ps. sorry for my poor english.

  7. Ruben Molendijk says:

    Dear Scott,I hope you can help me out on this one. On first sight it looks like something similar, but I suspect it’s really not.My version of CS2 worked fine for months, up until a few weeks ago. Now it takes ages to open a file, jpeg, tiff, whatever. Start-up however, is still smooth and using filters causes no particular slow-down. But creating a new file requires serious patience.I’ve monitored the task manager, but I can’t detect a memory leak.This problem seems to have coincided with a recent installation of a new game (Civ III), for wich I’ve updated my video driver. I have an ATI Radeon 9200SE (64 MB), now running under ATI Catalyst 1.2.2 drivers. Are there any known compatibility problems? Does this sound familiar to you?

  8. Scott Byer says:

    Timur,It’s not any specific font. It could be any font – I believe at this point that it’s something inside a system caching mechanism somewhere that is causing the problem, and moving the fonts out and then copying them back into the system fonts folder refreshes whatever bad data was created.If that trick doesn’t work for you, but turning off the font previews stops the memory leak, then that may be the workaround you have to live with for this release.-Scott

  9. Scott Byer says:

    Ruben,That’s a problem I hadn’t heard about before. I’m not sure what relation a video driver could have to opening or creating a new file would have. Now, if you said you’d updated a printer, that might make sense – we’ve seen a missing networked printer cause Photoshop to pause on opening or creating an image.One question is if the palettes are redrawing quickly for you or not – if you hit tab-tab, do the palettes redraw (near) instantly, or does it take 5 seconds?You might also want to monitor disk activity in Performance Monitor. There are many more items you can graph in there than what Task manager will show you; the trick is figuring out what is useful. Physical Disk/%Disk Time is a good gross-level counter for watching to see if something is going on with the disk.-Scott

  10. Ruben Molendijk says:

    Hey Scott,thanks for your quick response!I’ve tried the tab-tab test, but it redraws near instantly.I’ve used the Task Manager to have a look at a whole number of, eh, numbers, but I’m no expert, so I can’t really conclude anything from them.Here are some key numbers (translated from Dutch):Memory usage: +/- 73.000 kb (constant)VM size: 83.000 kb (also constant)Entries: 274I/O: read: 3.088I/O: write: 918I/O: written bites: 1.534.542.My CPU usage doesn’t do much during file opening, even though I would’ve expected it to go right to 100%. The memory also gives a flat line.I’ve changed the size of the Swap File to a fixed 1 Gb, but that didn’t do anything.How can I graph other variables in the Performance Manager? I seem to be stuck with CPU usage and swapfile history.

  11. Ruben Molendijk says:

    Hey Scott,sudden new development!I’ve changed the number of cache levels in Photoshop back to 6 (I had reduced them to 2 earlier) and switched Font Preview back on.I don’t know if it’s just luck or that it is actually related, but file opening time was reduced for a couple of file openings from 5 minutes to a more bearable 1.5 minutes. But after 5 files it was up to 5 minutes again.Still, there’s hope…

  12. Scott Byer says:

    Ruben,With the memory usage staying constant when the program at idle, you aren’t having the font problem I described. It could be something else slowing down disk access tremendously, or you may have Photoshop’s memory percentage set too high. Try 55% and see if that helps.-Scott

  13. Brian Poff says:

    Scott,I’ve got a file that is doing exactly the same thing. I’ve tried every suggestion you’ve mentioned and every one I’ve seen in the Forums, all to no avail. We’ve tried it on several PCs and one guy even took it home and tried it and it still ran out of memory.I formatted a hard drive and installed Win2K clean and when I open it up in CS2 (no additional fonts installed) it still crashes with out of memory. It opens fine on the same PC in PS 7.Do you have any other suggestions or want me to send you the file????Thanks,Brian

  14. Scott Byer says:

    Please! I may be able to figure a workaround for you, or figure out some other clue about what is going on.-Scott

  15. Brian Poff says:

    OK – How do I send it to you? Can you access my email and send me a message? I can post it on our website for you.– Brian

  16. Ruben Molendijk says:

    Hey Scott,the memory percentage was already on 55%, so I’ve reduced it to 40%, but it didn’t change anything.In case of another program or application slowing down disk acces, what would be a likely suspect? I have an on-demand virus scanner (Avast) and a firewall (Sygate) permanently running. Or could it be a virus?-Ruben

  17. Mark Tucker says:

    I think I’m having the same “delays” issue.I just installed a new G5 Quad. It’s running 10.4.4, with 4.5gigs of RAM. I had 100% Memory Allocation set in CS2, but I’ve also tried 90, and 70, and 50. Cache was set to 2, but also to 4.Video card is GeForce6600 with 30″ and 20″ aluminum monitors. I am running 32 external LaCie firewire drives, but the issue continues with all FW devices disconnected.I migrated from a G5DP2gig with 4.5RAM. I am running Macaroni, and have Repaired Permissions. There is a second, identical 250gig WesternDigital scratch disk drive, internal. Main drive is a 250g, and is basically empty.Issue: As I’m working in CS2, if I’m using, say, the Dodge Tool, or the Burn Tool, and I dig into the shadows of an image with the Dodge Tool, if I do that four or five times in a row, repeatedly, very quickly, by the time I get to the fifth “Dodge” action, the Quad sort of “freezes up” in a way, in that, it is about four or five seconds where the screen siezes, and I see no screen refresh from my action. After five seconds or so, I see the effect on the screen.At first, I thought I was overtaxing the GeForce card, so I unhooked the Tools monitor, the 20″. Problem still occurred.Then, I thought it might be a FireWire issue, so I copied my working files over to my internal drive, and unhooked all Firewire cables from the back of the Quad. Problem still occurred.I work with ActivityMonitor open, but I see no unusual activity during this freeze up.I am stumped. I thought this Quad should rock right along, especially with the added RAM.I’m also getting this odd dialogue box in Photoshop, many times, but not every time, when I go to print large prints to an Epson 9800. Image size approximately 40×60@300dpi, RGB 8bit.Any tips appreciated.Mark TuckerPhotographerhttp://www.marktucker.com

  18. Scott Byer says:

    Mark, I think what you may be seeing is the “painting pauses” issue. Chris Cox is currently busy trying to track down the cause.If you want to make sure it’s not the font issue, just turn off Font Previews in the Type Preferences panel. If the pauses go away, you have a funky font somewhere. If they don’t go away, it’s some other issue.-Scott

  19. Mark Tucker says:

    I wonder if it could be a RAM thing. As in, how the RAM is placed into the slots, and in what order. I have four one-gigs, and then two 256s. I want to rearrange their order, somehow, and check that. My issue seems to be the overall computer; not just Photoshop. I get lots of beach balls; just in normal work; very bad sign.

  20. Scott Byer says:

    Mark,It’s possible, but usually RAM errors result in random but quick deaths. I’ve seem hard drive issues result in long pauses (especially if a sector is just going bad, the OS can do a read retry a bunch of times before giving up). I’ve also seen loose internal cabling cause similar problems.Try the memory thing, check the internal cabling, see if you can find some drive analysis tools (TechTool Pro is pretty good, but you may be able to find some shareware S.M.A.R.T. drive analysis tool).And good luck!-Scott

  21. Mark Tucker says:

    (Scott, You may choose to post this for other readers, or pass this to Chris).Another user in Brazil that I spoke to, switched out the order of his additional RAM chips, and I just tried the same thing, and while it did not completely solve the problem, it certainly helped out. Radically.Starting from the center of the RAM slots, the innermost slots should contain the most powerful RAM, and then, as you work outward, the RAM should be installed to where the lesser RAM capacity is toward the outside. Mine now is: Inner is 1 gig pair, then second pair are more 1gigs, then the third pairs are 256megs. A total of 4.5 gigs, but the smaller ones toward the outside.Maybe that gets us closer to a resolution.Mark Tuckerhttp://www.marktucker.comQuad G510.4.4CS230″/20″ on GeForce 66004.5 gigs RAM

  22. Georgi says:

    HelloI’m using Adobe Photoshop CS2 and I have big troubles when I’m using it. I use Photoshop for drawing – with tablet Wacom Graphire 4. Mostly I work in 300 dpi resolution. When I start drawing in every 4-5 actions – selection, drawing with brushes, using smudge etc. the program freezes for few seconds and this happen every 4-5 actions. Also I’ve notices that the programs creates a huge temp file in the scratch disc – about 4-5 gigabytes, and continues to grow until it fills the hard drive disc free space. But even when I have a lot of free space the program freezes runs very slow and it is impossible to work.My computer system is Athlon 64 3200+, 512 Ram, 80 Gb Hard Disc.I hope that you can help me. Thank you in advance.

  23. Scott Byer says:

    Georgi,If the files you are working on are anything over 40MB (which, at 300dpi, isn’t going to take much in terms of size or number of layers), the amount of memory you have in the machine is much smaller than it needs to be. Only stating the resolution of the files isn’t enough – a file’s size is a combination of size in pixels and number of layers.Check that Photoshop’s memory percentage isn’t set too high (on a machine with so little RAM, I’d recommend no higher than 50%). And use Performance Monitor (Programs -> Administrative Tools -> Performance) to watch the amount of free RAM on the system. If it is getting below 20MB, then Windows will start paging, and you will definitely end up waiting, and that is probably what is currently happening on that machine. While 512MB meets the minimum system requirements, it isn’t going to make for a very fast system, especially when doing involved image editing on larger files.-Scott

  24. Scott Byer says:

    Mark,The painting pauses are a slightly different issue, but still interesting. We hope to have more news on the painting pause soon.-Scott

  25. Uzbek says:

    Thanks for the post. It was really helpful.But any of you have resolved the memory leaking problem with Photoshop CS2. I guess it happens when PS is installed on machine with Windows SP1.Anyways thanks for the post yet again….

  26. Scott Byer says:

    Uzbek,Note that there are only two known memory leaks at this point – this font related one, which can be worked around by turning off the font menu preview in the Type Preferences panel (or by figuring out which font Windows has a bad cache for), or a leak when opening files with lots of old type layers and missing fonts.The key thing is to use a measuring tool to watch memory and see what is happening.Note that Photoshop does not release memory after closing an image, and this is on purpose and has many good reasons behind it (which I’ll be covering in an upcoming post…)-Scott

  27. suresh says:

    i had a started a new site http://www.adsveda.com for helping computer professionals like.if anybody know something about computerlike photoshop,php,etc.you can mail it as tutorials we will publish it freely,with your name.if you know something mail me that to adsveda@yahoo.co.in

  28. Matty and andrew says:

    hey,having a memory leak problem with cs2. Both myself and andy are working as digital illustrators at this company and have found cs2 to be decidedly unrelieable. Quite frequently when painting away with our tablets (with a brush that is perfectly capable of updating onscreen in real time) we find photoshop freezes up. It doesnt crash, and you can still drag the windows around so it is relatively stable. But you cant save and you cant do anything within an image window. Open task manager and ram usage is low but cpu usage up between 97-99%, we’ve tried waiting it out, changing scratch disks etc but no joy.CS1 was handling the same actions no problem before the upgrade, and we both have fresh installs of XP (for the new job). We have similar system stats but not identical (jus similar performance etc).its kinda annoying… any ideas?thanks 😀

  29. Adept says:

    Scott,Sometimes ago I had similar problem (memory leaking) and it was solved by fonts removing.Now I was trying to do it on 2 computers and had no success in it — Photoshop still contstanlty eats my memory.Is it possible that there are other reasons could lead to that?Do you have any utility that can scan my fonts and find an broken one?

  30. geraldo says:

    I just wonder because the comments were before the release of 9.0.1:are the painting pauses resolved now completely with this update – or can they still show up?additionally, do I get it right that IF 9.0.1 resolves the issue, one shouldn’t install the DisableVMBuffering.plugin to have advantage of more than 4 GB RAM? or is it possible that one needs to install it also?AFAIK, this is also an issue with CS aka 8 (can’t check at the moment)?thanks, gerald

  31. Alex says:

    Hi Scott,I have CS2 9.0.2 and I have the font related memory leak. I have deactivated Font Preview Size and it’s working fine. Moving fonts didn’t help me.And even with Preview Size enabled, if I want to add text it gives an error: Could not complete your request because something prevented the text engine from being initialized.Also it doesn’t generate any previews, all the fonts are shown with the default font.If I move all the fonts from the Fonts folder and I remain only with the basic system fonts Photoshop gives an error: Unable to continue because of a hardware or system error. Sorry but this error is unrecoverable.If I move back only the Times New Roman font, Photoshop loads nicely but the memory leak is still happening.What shall I do now? (I have 2 gigs of ram)

  32. Gez says:

    There’s a leak in the color picker also. Sometimes you open the picker and you get a “not enough memory” error. If you press OK nothing happens, all seems to be ok… but when you try to save the file, or copy to the clipboard or ANYTHING you get again and again the error, and kiss goodbye your work.It’s annoying and it wasn’t addressed in the .01 and .02 updates.

  33. Lisa Brown says:

    Scott,I am having a problem with Photoshop CS and the type tool it will not allow we to type prompting me that something has prevented the type engine to be initalized? Do you know how to fix this? Please let me know ASAP I cannot find any information about this anywhere. Can you help?Lisa – 12:00 October 29

  34. Zakkorn says:

    Hi,last month I encounter a problem in my PC with photoshop.If I begin working on file after a while, photoshop will throw me out or I ll have a BSOD or the PC will restart.While I can work on 3ds max for much longer times and with “heavier” scenes with no problem at all.I tried many things, even reinstall XP but still the same problem.I am using Photoshop CS2 and even updated to 9.02.Unfortunately these days that I discovered that problem were the 1st time I tried to work seriously with photoshop in this PC. Before I was just using it for fast thins as for croping.In my older PC I didnt have any problem with photoshop CS2 or older.Any ideas or help will be appreciated.

  35. Tin says:

    Hi Scott,I got the same problem for using text function on photoshop CS2 9.02 also. It just doesn’t work for me if I use MS wireless keyboard set. When I installed the keyboard driver (whatever new or old version), the CS2 text function and the shortcut function are both prevented. However, it works normally when I use other band keyboard driver or traditional keyboard (with cord).

  36. Guest says:

    It helped me to remove the font loaded when Photoshop loads – from Control Panel > Fonts.Good luck.

  37. Eddie says:

    2 issues that I came across when I installed Photoshop CS2.1) Slow performance, memory leak, bad fontsPhotoshop CS2 is installed with Font Preview turned on by default. This can cause problems when you have a bad font. To turn it off, go to “Edit > Preferences > Type” and uncheck Font Preview and voila, Photoshop works great.When I tried to turn Font Preview back on, I got the following error message below.2) Error: Could not complete your request because something prevented the text engine from being initialized.After some tests, these were the Fonts that I had trouble with..AR MinchoL JIS (True Type) JMIN00L.TTF 3975KAR MingtiM BIG-5 (True Type) BMIN00M.TTF 7674KAR MingtiM GB (True Type) GMIN00M.TTF 3816KAR MingtiM KSC (True Type) KMIN00M.TTF 4398KAfter I moved these fonts out from “Control Panel > Fonts” to a different directory, Photoshop loaded fine and worked great.Next I moved these fonts back to “Control Panel > Fonts”, and Photoshop seems to fixed itself and I couldn’t generate the same error again.Hope this helps some of you..