Hello, I’ve been using Processing for the past 4 weeks and it’s my new favorite IDE! I’ll work on a sketch for about an hour, and when I frequently re-run a sketch, my computer will freeze. The last time it happened, I waited, and saw in Activity Monitor that Processing was taking up 11GB of memory when no sketch was open or running. Please let me know what logs/diagnostic files I can gather to help with catching this performance bug.
You might be loading resources e.g. loadImage(...)
, inside the draw() method which is executed 60 times a second. Difficult to comment further without seeing some code.
I don’t use loadImage()
. I was able to reproduce it again, with this sketch: GitHub - arkwl/PackingGenuary: Packing submission for genuary2022 that reproduces Processing performance bug.
I also observed this in Activity Monitor:
One issue with that particular example is that you are allocating your randomColors array inside each and every instance of PackingShape. Move that array to a global variable (just stick it above the class definition) and you’ll save a fair bit of memory and speed things up.
Memory usage is often tricky to define. It’s hard to know what all that Activity Monitor is counting. Things like graphics video buffers and shared libraries can appear to take up a lot of memory, but in reality, they are being shared between many different processes running on your computer and aren’t really taking up that much memory on their own.