The following code will leak memory
while (true) {
float[] sample = new float[inlet.info().channel_count()];
inlet.pull_sample(sample);
}
Whereas this works properly
float[] sample = new float[inlet.info().channel_count()];
while (true) {
inlet.pull_sample(sample);
}
I my experiment, I was collecting data at about 1 kHz. After an hour using the first snippet, my Java process was using about 20 GB. This obviously has an easy work around, but it does indicate that there is memory leaking somewhere (inside the native code?).