Hi.
Using code below it sometimes gives, and sometimes not, an error: (counter value below 4000 does not give an error. -using APDE-)
Free memory = 4649576
java.lang.OutOfMemoryError
at processing.a2d.PGraphicsAndroid2D.loadPixels(PGraphicsAndroid2D.java:2024)
at processing.a2d.PGraphicsAndroid2D.endDraw(PGraphicsAndroid2D.java:262)
at processing.test.sketch_20180813a.sketch_20180813a.overlayScreen(sketch_20180813a.java:43)
at processing.test.sketch_20180813a.sketch_20180813a.setup(sketch_20180813a.java:28)
at processing.core.PApplet.handleDraw(PApplet.java:1801)
at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:471)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:503)
Code:
PGraphics ops;
int counter;
long freeMemory;
void setup(){
fullScreen();
counter = 10000;
freeMemory = Runtime.getRuntime().freeMemory();
println("Free memory = " + freeMemory);
overlayScreen();
image(ops, -9900, 0);
}
void draw(){
}
void overlayScreen() {
ops = createGraphics(counter, 500);
ops.beginDraw();
ops.stroke(50);
ops.line(0, 40, counter, 40);
ops.endDraw();
}
Any idea how to prevent?