I have a Tuner App and I have heavy computations in background. I have noticed that I have had frequent garbage collections when computing. I have replaced:
float someBigArray = new float[bigNumber];
with global array:
if (someBigArray == null) {
someBigArray = new float[bigNumber];
} else {
Arrays.fill(someBigArray , 0f);
}
This array is used when computing FFT and this is called multiple time per second. I've get rid of frequent garbage collections but I'am not sure that it is more efficient solution. Maybe there is some better idea.