Skip to main content
Participating Frequently
May 6, 2010
Question

Tracking down memory issues in Photoshop

  • May 6, 2010
  • 1 reply
  • 774 views

One of my users is reporting a crash.  My plug-in will throw up an error message whenever it requests memory from Photoshop and receives a null pointer / the memory allocation fails.  He gets it only after working 15min-2hours.

I cannot exactly reproduce this problem on my machine.  However:

1- In general, you can easily make Photoshop crash if you go into Edit -> Preferences -> performance  and set the memory usage to the maximum.

Using Photoshop's built-in plug-ins, it is possible to make Photoshop crash without calling 3rd party plug-ins.

Perhaps a slightly better design would be if that dialog would throw up a message box recommending that the user not set the memory so high?

1b- Because of that, I am not sure how to separate out plug-in crashes from Photoshop crashes.  Does anybody have ideas?

2- It's possible that my plug-in has a memory leak...I know from experience this can also cause crashes.  I don't think this is the case.

This topic has been closed for replies.

1 reply

Noel Carboni
Legend
May 11, 2010

I suggest you instrument your memory allocation / deallocation calls with a "total allocation" accumulator that shows how much you have allocated (i.e., you add in the amount allocated, you subtract out the amount deallocated).  Then log that counter at key times, for example at the end when you've done all your cleanup.  If the counter doesn't get back to 0 exactly you have a problem in the plugin.

-Noel

Glenn_ChAuthor
Participating Frequently
May 12, 2010

Good suggestion- thanks!

Glenn_ChAuthor
Participating Frequently
May 21, 2010

As usual, this was my fault.  Set a bufferID to NULL accidentally and therefore it wouldn't release properly, etc. etc.