Solved Memory Error in Processing

processingmemoryerror.jpg

After much hand wringing, I seem to have solved an out of memory error in Processing, specifically “java.lang.OutOfMemoryError”. Here’s the fix:

1. Quit Processing. If Processing is running when you make this change, it won’t work.
2. On the Mac, go to Users, then your home directory then Library, then Processing, then preferences.txt. That’s: ~/Library/Processing/preferences.txt and not other files with the same name.
3. In that particular preferences.txt file, change the line that says “run.options =” to be “run.options = -Xms128m -Xmx1024m” Other numbers might work too, but start with those.
4. Save the changes and start up Processing.

Some of this information came from the Processing Wiki.

Apparently the issue for me was the cumulative size of the images I was displaying. It was fine to “load” them, but once I used “image” to display them, they started taking up memory. After about 175 different images of 20K each had been displayed, I ran out of memory. (Note that once a particular image has been displayed, subsequent uses of “image” to redisplay the same image do not use additional memory, so you can redisplay to your heart’s content, once you’ve got enough memory allocated to begin with).

Woo-hoo! (I hope).

Scroll to Top