Compiler does not report space taken by big char arrays??

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Compiler does not report space taken by big char arrays??

Postby WiFive » Sat Apr 07, 2018 11:52 pm

kolban wrote:My understanding is that when we compile an application, from a RAM usage perspective, some will be initialized RAM (.data), some will be uninitialized data (.bss). Sum those together and we have the amount of RAM that is pre-allocated by the application. Within the ESP32 there is an available amount of RAM which I think is on the order of 180K. We subtract 180K - .data - .bss and what is left then becomes heap accessible storage. When you perform malloc() requests (explicitly or implicitly) this is drawn from heap. That includes creating FreeRTOS tasks whose stack (if I understand it correctly) are also drawn from heap.
There is 320k but only 176k can be used for static memory with current linker scripts. But the heap can still use it.

rin67630
Posts: 139
Joined: Sun Mar 11, 2018 5:13 pm

Re: Compiler does not report space taken by big char arrays??

Postby rin67630 » Sun Apr 08, 2018 7:11 am

WiFive wrote: There is 320k but only 176k can be used for static memory with current linker scripts. But the heap can still use it.
We seem to have got another limit, since the memory appears to be segmented.
"region `dram0_0_seg' overflowed" happens with a declared array of around 110.000 bytes on an else empty sketch.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Compiler does not report space taken by big char arrays??

Postby WiFive » Sun Apr 08, 2018 8:42 am

An "else empty sketch" isn't really nothing though because it is built on top of esp-idf freertos and reserves 64k for bluetooth

rin67630
Posts: 139
Joined: Sun Mar 11, 2018 5:13 pm

Re: Compiler does not report space taken by big char arrays??

Postby rin67630 » Sun Apr 08, 2018 10:46 am

WiFive wrote:An "else empty sketch" isn't really nothing though because it is built on top of esp-idf freertos and reserves 64k for bluetooth
That's clear. The reserved memory should already have been accounted for by the compiler when reporting the amount of of dynamic memory, and the left bytes for local variables, shouldn't it?

Your statement leads me to two additional questions:
- is freeRTOS already on board, usable without additional include?
- if bluetooth is not required, can I release that memory with the Arduino IDE?

Who is online

Users browsing this forum: Majestic-12 [Bot] and 149 guests