Hi all.
the doc. said that ESP32-WROOM-32D (4MB HIGH TEMP), and siad:
There is 520 KB of available SRAM (320 KB of DRAM and 200 KB of IRAM) on the ESP32. However, due to a technical limitation, the maximum statically allocated DRAM usage is 160 KB. The remaining 160 KB (for a total of 320 KB of DRAM) can only be allocated at runtime as heap.
what this means?
if I have a Array[i][8] = {"xxx", "xxxxxx". "xxxxxx", "xx.xxxxxx", "xxx.xxxxxx", "xx", "xxxxxx", "xxxxxx"};
each x indicated a Arabic numerals, what can be the max. i ? possible upto 500?
thanks
adam
The first thing that you need to do is to make sure that each individual string fits in the space allocated to it. That is not the case for your example as a number of then exceed the space allocated.
Note too that each string has a hidden terminating zero that needs space to be store
Seeing a string such as "xx.xxxxxx" makes me wonder whether what is being stored is a representation of a float. Is that the case here ?
You are asking a detail question without adding informations about your project.
It might be that this is a pure academic detail-question. I don't know.
If you are planning a project with a huge array for numbers with 8 digits
example
12.345678
or
123456.78
you could use longs with moved decimal point.
example
12.345678
could be multiplied with 1000000
to result in
12.345678 * 1000000
12345678
which would only need 4 bytes of memory instead of 10 bytes as ascii-coded char-array.
8 dgits + 1 decimal point plus terminating zero = 10 bytes for 8 digits
Thanks.
Yes, that are GPS lat/lon float.
I used the array[][] to store GPS data and got rebooting when serial.print, it's why I guess may memory question?
As suggested by @StefanL38, it would be more sensible for them to be stored as raw data in the array rather than as strings. What is the rest of the data apart from the lat/long values ?
When the data is in the array what are you intending to do with it ? Does it even need to be in the array considering that you mention that the data has been saved to an SD card ?
Here is a testcode that fills an array with 12905 elements each 8 bytes long which sums up to 103240 bytes.
#define max 12905
char myBigArray[max][8] = {
// 12905 lines with
"1234567",
};
void setup() {
Serial.begin(115200);
Serial.println("Setup-Start");
}
void loop() {
for (int i = 0; i < max; i++) {
Serial.print("i:");
Serial.print(i);
Serial.println(myBigArray[i]);
}
}
compiler says
Sketch uses 364129 bytes (27%) of program storage space. Maximum is 1310720 bytes.
Global variables use 124576 bytes (38%) of dynamic memory, leaving 203104 bytes for local variables. Maximum is 327680 bytes.
So it is very likely that your code has a bug.
If you were using variable type String it might be that RAM got all eaten up by repeatedly assigning new Strings
I recommend that you start thinking loooooonger about your problems
and I recommend that you start learning throuroughly