Hello guys,
I have a problem on my newest project with the Teensy 3.1:
I want to use a big array of float temperatures (size 6000) in order to put them into a gaussian blur function.
So my method starts like this:
In the middle it does some operations with the array and finally I want to free it:
The method FreeRam() prints me the RAM usage of the Teensy. Now the weird part comes:
So for some reasons, the memory is not deallocated correctly. This leads to allocation issues if I call the method again at a later point.
Can anyone help me how to solve this problem ?
Thanks !
I have a problem on my newest project with the Teensy 3.1:
I want to use a big array of float temperatures (size 6000) in order to put them into a gaussian blur function.
So my method starts like this:
Code:
void ImageCreation(float** temperatures, bool save) {
Serial.print("Free ram before allocation:");Serial.println(FreeRam());
float* filtertemp = (float*) malloc(6000*sizeof(float));
...
Code:
...
free(filtertemp);
Serial.print("Free ram after deallocation:");Serial.println(FreeRam());
//Close the files
if (combinedImage)
bmpFile.close();
if (save)
thermalImage.close();
}
The method FreeRam() prints me the RAM usage of the Teensy. Now the weird part comes:
Code:
Free ram before allocation: 39911
Free ram after de-allocation: 15335
So for some reasons, the memory is not deallocated correctly. This leads to allocation issues if I call the method again at a later point.
Can anyone help me how to solve this problem ?
Thanks !