The problem is almost certainly caused by line 30
PImage slice = createImage(size, pg.height, RGB);
since this is called from the draw method it is creating a new image approximately 60 times a second and I suspect that the garbage collector is not keeping up with the program.
You need to think carefully about what you want to achieve and design an algorithm that does not invlove creating PImage every frame.
PImage slice = createImage(size, pg.height, RGB);
since this is called from the draw method it is creating a new image approximately 60 times a second and I suspect that the garbage collector is not keeping up with the program.
You need to think carefully about what you want to achieve and design an algorithm that does not invlove creating PImage every frame.