Where is my RAM ?, i want more !
-
- Posts: 8
- Joined: Sun May 07, 2017 4:40 am
Where is my RAM ?, i want more !
im progamming ESP32 with arduino IDE. I choose ESP32 because It has big RAM and ROM, super Fast clock.
But,Why esp32' RAM is smaller than i though (500k) ?. Just 299912 bytes RAM . hummmm.
I used 130000 byte for a BIG array. i think my skecth will around 170000 bytes. (It's free about 120000 bytes ). But it doesn't work !
its not my falt. When i resize that BIG array to 90000 bytes and it worked well as i want.
So i think the problem is LOW RAM .
Can you explan ? i want more 299912 bytes RAM .
But,Why esp32' RAM is smaller than i though (500k) ?. Just 299912 bytes RAM . hummmm.
I used 130000 byte for a BIG array. i think my skecth will around 170000 bytes. (It's free about 120000 bytes ). But it doesn't work !
its not my falt. When i resize that BIG array to 90000 bytes and it worked well as i want.
So i think the problem is LOW RAM .
Can you explan ? i want more 299912 bytes RAM .
Re: Where is my RAM ?, i want more !
Ram is shared with wifi, TCP/IP, cache and freertos. If you disable those things you can have more ram. The problem is probably because ram is divided up into different sections and your huge array can't fit into one section.
Also you can wait for new modules with 4mbyte extra ram
Also you can wait for new modules with 4mbyte extra ram
Re: Where is my RAM ?, i want more !
Also don't forget that 328k of RAM is usable as DRAM, the other 192k is IRAM (instruction RAM).
Out of 328k, as WiFive has mentioned, parts are used by the RTOS and WiFi/BT stacks.
I suppose that the available RAM estimation in Arduino IDE may be working incorrectly in case BT is enabled in menuconfig:
https://github.com/espressif/arduino-es ... ds.txt#L11
This assumes that BT stack is not reserving part of DRAM for BT controller exchange memory. So the actual available size may be ~64 less.
Out of 328k, as WiFive has mentioned, parts are used by the RTOS and WiFi/BT stacks.
I suppose that the available RAM estimation in Arduino IDE may be working incorrectly in case BT is enabled in menuconfig:
https://github.com/espressif/arduino-es ... ds.txt#L11
This assumes that BT stack is not reserving part of DRAM for BT controller exchange memory. So the actual available size may be ~64 less.
-
- Posts: 8
- Joined: Sun May 07, 2017 4:40 am
Re: Where is my RAM ?, i want more !
Here is my code, just Examples.:
"Sketch uses 105,566 bytes (10%) of program storage space. Maximum is 1,044,464 bytes.
Global variables use 139,492 bytes (47%) of dynamic memory, leaving 155,420 bytes for local variables. Maximum is 294,912 bytes."
But it's not working !
When i change b[130000] is b[100000] -> it works.
Then i tryed to read a document (esp32) talking about Array and Heap - Stack Memory erea.
(I added Static before ), the code is :
It worked!
The next section:
I fix all Array is Static but it just work when array's size smaller 90k bytes. I fail!
I'm thinking about use External RAM like SPI ram (23lc1024) or PC ram to get more data....haizzzz
Code: Select all
uint8_t b[130000];// 130k bytes
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Ok !");
b[1]=0;
delay(1000);
}
Global variables use 139,492 bytes (47%) of dynamic memory, leaving 155,420 bytes for local variables. Maximum is 294,912 bytes."
But it's not working !
When i change b[130000] is b[100000] -> it works.
Then i tryed to read a document (esp32) talking about Array and Heap - Stack Memory erea.
(I added Static before ), the code is :
Code: Select all
static uint8_t b[130000];// 130k bytes
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("Ok !");
b[1]=0;
delay(1000);
}
The next section:
I fix all Array is Static but it just work when array's size smaller 90k bytes. I fail!
I'm thinking about use External RAM like SPI ram (23lc1024) or PC ram to get more data....haizzzz
Re: Where is my RAM ?, i want more !
I have the same problema, in latest arduino esp32 integration 96000 is máximum, but there should be 280k available acording to the man himself:
"Just to expand on what @me-no-dev said: 520KB is the total amount of RAM. That includes IRAM (instruction RAM), DRAM (data RAM), and RTC memory. "System and memory" chapter of the ESP32 Technical reference manual has a table explains this in more detail. Specifically, there is 328 KB of DRAM available on the chip (the rest is IRAM and RTC RAM). Some of that is used by the OS, some is used by tasks created during SDK startup. An empty application which just prints the amount of available heap will report ~300KB of free heap, in the latest IDF.
Enabling features such as WiFi, BT, and dual core support, reduces the amount of memory available to applications. I guess this is where the 280KB number comes from."
my code looks like this:
if i up that 96000 value, esp32 enters a reset loop after compilation
Any help?
"Just to expand on what @me-no-dev said: 520KB is the total amount of RAM. That includes IRAM (instruction RAM), DRAM (data RAM), and RTC memory. "System and memory" chapter of the ESP32 Technical reference manual has a table explains this in more detail. Specifically, there is 328 KB of DRAM available on the chip (the rest is IRAM and RTC RAM). Some of that is used by the OS, some is used by tasks created during SDK startup. An empty application which just prints the amount of available heap will report ~300KB of free heap, in the latest IDF.
Enabling features such as WiFi, BT, and dual core support, reduces the amount of memory available to applications. I guess this is where the 280KB number comes from."
my code looks like this:
Code: Select all
#define MAX_DELAY 96000
uint8_t sDelayBuffer0[MAX_DELAY];
Any help?
Re: Where is my RAM ?, i want more !
region `dram0_0_seg' overflowed by 26056 bytes
that's what i get in my sketch when compiling for more than 96000
that's what i get in my sketch when compiling for more than 96000
Code: Select all
#define MAX_DELAY 130000
static uint8_t sDelayBuffer0[MAX_DELAY];
-
- Posts: 9713
- Joined: Thu Nov 26, 2015 4:08 am
Re: Where is my RAM ?, i want more !
A few things:
- While it may have changed, not all RAM is available as statically-allocated (ie the way you allocate it now) RAM, because for some regions, the compiler/linker cannot know if it'll be available at run-time. If you allocate memory using malloc() or the c++ 'new' operator you won't have this issue.
- The RAM does not consist of one contiguous chunk. The largest chunk possibly is something like 100K or so, so that's the value you see. If you allocate multiple small bits of memory, you will see that you can easily allocate more than this amount, because the heap allocator doesn't need to return the one contiguous chunk to you.
- While it may have changed, not all RAM is available as statically-allocated (ie the way you allocate it now) RAM, because for some regions, the compiler/linker cannot know if it'll be available at run-time. If you allocate memory using malloc() or the c++ 'new' operator you won't have this issue.
- The RAM does not consist of one contiguous chunk. The largest chunk possibly is something like 100K or so, so that's the value you see. If you allocate multiple small bits of memory, you will see that you can easily allocate more than this amount, because the heap allocator doesn't need to return the one contiguous chunk to you.
Re: Where is my RAM ?, i want more !
Thanks for your help;
i tried the three posible solutions you mentioned , new , malloc() and splitting into two chunks of memory, and problema is exactly the same
once you go past 96000 , you'll get continous reset loop ; when splitting into two buffers, once you exceed 96000 in the sum of both, problema is the same
Could this mean that in practical terms , in arduino esp32 all we have of the 280 k left by everything else, is just 96000 bytes?
thanks again!
i tried the three posible solutions you mentioned , new , malloc() and splitting into two chunks of memory, and problema is exactly the same
once you go past 96000 , you'll get continous reset loop ; when splitting into two buffers, once you exceed 96000 in the sum of both, problema is the same
Code: Select all
byte *sDelayBuffer0 = ( byte* ) malloc( 48000 );
byte *sDelayBuffer1 = ( byte* ) malloc( 48000 );
thanks again!
Re: Where is my RAM ?, i want more !
if you're doing this in arduino, there's almost no way you'll find more than 96000 as a single chunk. I ran into this often. Using pure esp-idf I can easily create 130000 with no problem, even as static. Infact, I was able to go up to 165492.
Who is online
Users browsing this forum: No registered users and 37 guests