processing / processing/processing4
curveVertex() causes OutOfMemory in P2D renderer
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 494
- Forks
- 183
- Avg merge
- 4h 39m
- Merged PRs (30d)
- 3
Description
Created by: Real-John-Cheung
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied Processing 4.3 sketch with the P2D renderer, comparing 26,000 and 2,000 curveVertex() calls and the Java2D version. Trace the beginShape(), curveVertex(), and endShape() entry points through the P2D renderer. Done means the large sketch no longer exhausts the Java heap while preserving the expected curve output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100