Increasing kernel_task memory usage on Mac OS X / Processing 3.0

I couldn't find any references to this problem online, probably because 3.0 is still reasonably new, but now that I've solved it I thought I'd share. Maybe this will come up in someone's Googling now.

I was seeing that after running for a while, not even very long, kernel_task would start using up so much memory that it would nearly crash the system. This seemed pretty strange, since it wasn't even the Java process itself running out of memory, it was just causing something indirect.

The problem turned out be in my usage of the new surface.setResizable(). This document introduces the new usage: https://github.com/processing/processing/wiki/Changes-in-3.0

Note that it shows that you should set this property once, in setup(). For some reason, that appeared not to work, so I tried putting it in draw(), which did work, but which ultimately caused this bad situation. I was wrong, it does work in setup(), and that's where it should be called, once.

To sum up, this is bad:

public void draw() { surface.setResizable(true); // other stuff }

And this is good:

public void setup() { surface.setResizable(true); } public void draw() { // other stuff }

Sign In or Register to comment.