nkolban / ESP32_Explorer

ESP32 Explorer
Apache License 2.0
144 stars 37 forks source link

Out of RAM #8

Closed chegewara closed 6 years ago

chegewara commented 7 years ago

Hi, there is too low heap to start webserver. Before web server starts heap is about 40kB, giving him stack about 20kB system crashes even before all path handlers are added, i have had to comment out 3 of them to run program.

nkolban commented 7 years ago

Do you also have the BT stack enabled? What we need to consider is the overhead of:

I believe that each of these will "eat some heap" even before we get anywhere near our application logic. In the ESP32 Explorer Git master, we haven't enabled BT yet. If you wish, I can look at your driver and see if we can spot where heap usage can be relieved.

chegewara commented 7 years ago

Yes, bt stack enabled with about 13kB stack setup in menuconfig.

It would be nice if you can look at it, cause i have no idea where to free some heap.

nkolban commented 7 years ago

Here's something that might help .. I just finished adding this and will be committing in a few minutes:

image

This shows the FreeRTOS tasks running in the system and how much RAM is allocated to each for stack space.

chegewara commented 7 years ago

This is the difference in free heap with and without BLEUtils measured in this line https://github.com/chegewara/ESP32_Explorer/blob/master/main/ESP32Explorer.cpp#L433: D (3297) ESP32Explorer: 28204 D (3299) ESP32Explorer: 3952

Without BLEUtils i can scan for BLE devices. Its possible that some other tweaks in menuconfig also helps.

nkolban commented 7 years ago

Just added sorting of the tasks in the table so that they are in alphabetic order.

nkolban commented 7 years ago

Let's leave this issue open while we still have opportunities to free up memory. New fix coming now.

This one will give us north of 25K more. It is a fix in BLEUtils in ESP32-SNIPPETS. I'll log an issue there with details.

chegewara commented 7 years ago

Still is small issue with ram/heap. When you try BLE functionality and then try to read GPIO then app crash. This issue cant be resolved until espressif devs resolve this https://github.com/espressif/esp-idf/issues/1162

chegewara commented 6 years ago

I think i have resolved it in last PR, at least till we add more libraries/features.

chegewara commented 6 years ago

Commentig those lines gives another 24kB+ https://github.com/nkolban/ESP32_Explorer/blob/master/main/ESP32Explorer.cpp#L526-L527

chegewara commented 6 years ago

I think we have definitely ended with this issue.