processing4 icon indicating copy to clipboard operation
processing4 copied to clipboard

curveVertex() causes OutOfMemory in P2D renderer

Open Real-John-Cheung opened this issue 10 months ago • 0 comments

Description

curveVertex() causes java.lang.OutOfMemoryError: Java heap space error when the vertex amount is big in P2D render. With the default Java2D render it works fine.

void setup(){
  size(800,800, P2D);
  beginShape();
  for(int i = 0; i < 26000;i ++){ 
    curveVertex(i * 0.1, 100);
  }
  endShape();
}

Above sketch crashes due to OutOfMemoryError, below sketches can be executed without problem:

void setup(){
  size(800,800);
  beginShape();
  for(int i = 0; i < 26000;i ++){ 
    curveVertex(i * 0.1, 100);
  }
  endShape();
}
void setup(){
  size(800,800, P2D);
  beginShape();
  for(int i = 0; i < 2000;i ++){ 
    curveVertex(i * 0.1, 100);
  }
  endShape();
}

Your Environment

  • Processing version: 4.3
  • Operating System and OS version: macOS 14.4.1
  • Other information: on a Intel Mac

Possible Causes / Solutions

Might have something to do with how Catmull-Rom splines is calculated in P2D?

Real-John-Cheung avatar Apr 12 '24 14:04 Real-John-Cheung