Can processing run out of memory?

I'm currently making a program to select certain colors of the same type in a picture, like a magic wand tool.

After running several times I've noticed that smaller pictures are processed just fine, while larger ones, like the size of my monitor, freeze the program indefinitely. I receive no error, just the same screen. Could this be a memory problem?

Tagged:

Answers

  • edited January 2016 Answer ✓

    Yes it is. Java, if programmed in a way such that the VM can't optimize, or programmed in an inefficient computational way (such as user defined types (AKA Processing's Color type) that require the VM todo lookup and offset calculations) it will run out of available VM memory. The available space on the heap can be constrained by the VM and doesn't necessarily pertain to the amount of RAM in your computer.

    Think about the way you're solving your problem and try to simplify the steps, maybe load the data as a byte array or buffer and take advantage of Java's low-level performance speed. Use logical operands and small data types to split your problem into easily computable stages.

    This could also be your computer's specs since Processing is not optimized for the GPU and relies a lot on basic RAM copies to do large color type array modifications. A lot of Java's base types have advantages over color object types, which is noted in the documentation.

  • Answer ✓

    You can assign processing more memory in preferences

Sign In or Register to comment.