Sketch crashing suddenly when using Minim+OpenGL
in
Core Library Questions
•
3 months ago
I'm getting an "Invalid memory access" error along with an alert saying that OpenGL crashed when the following processing sketch runs for about 1-2 minutes, how can I fix it?
ERROR MESSAGE:
java(897,0xb1937000) malloc: *** mmap(size=1228800) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
java(897,0xb1937000) malloc: *** mmap(size=1228800) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
java(897,0xb1937000) malloc: *** mmap(size=1228800) failed (error code=12)
*** error: can't allocate region
Invalid memory access of location 0xa00 eip=0x2295c59b
*** set a breakpoint in malloc_error_break to debug
SKETCH:
import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;
Minim minim;
AudioInput in;
FFT fft;
int w;
PImage fade;
void setup() {
size(640, 480, OPENGL);
frameRate(60);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 512);
fft = new FFT(in.bufferSize(), in.sampleRate());
fft.logAverages(60, 7);
stroke(236, 240, 241);
w = width/fft.avgSize();
strokeWeight(w);
strokeCap(SQUARE);
background(0);
fade = get(0, 0, width, height);
}
void draw() {
background(0);
tint(255, 255, 255, 250);
image(fade, 0, 0);
noTint();
fft.forward(in.mix);
for(int i = 0; i < fft.avgSize(); i++) {
line((i * w) + (w/ 2), height/2 + fft.getAvg(i) * 3, (i * w) + (w / 2), height/2 - fft.getAvg(i) * 3);
}
fade = get(0, 0, width, height);
}
1