Heap Fragmentation and Deep Sleep

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Heap Fragmentation and Deep Sleep

Postby czuvich » Sun Oct 21, 2018 4:48 pm

Does putting the ESP32 into deep sleep "reset" the heap allocations? I basically scan for BLE devices every 5s or so, then if there's nothing to do I put it into deep sleep for X seconds.

I was either going to use vectors for performing work, or statically allocated buffers depending on if I should be concerned about heap fragmentation. I'm fairly new to MCU programming. Thanks!

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

Re: Heap Fragmentation and Deep Sleep

Postby WiFive » Sun Oct 21, 2018 10:16 pm

Coming out of deep sleep is basically like a cold boot with a few exceptions like rtc ram and wake stub. But if you want your app to resume you have to use light sleep.

ESP_Sprite
Posts: 9725
Joined: Thu Nov 26, 2015 4:08 am

Re: Heap Fragmentation and Deep Sleep

Postby ESP_Sprite » Tue Oct 23, 2018 2:29 am

That, or manually save whatever you need to save to RTC RAM.

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: Heap Fragmentation and Deep Sleep

Postby czuvich » Thu Oct 25, 2018 5:50 pm

Does setting the option ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF reset the RTC/ULP RAM when the ESP32 is put to sleep? That way I can put a vector into RTC RAM, and when there's nothing in RTC RAM I can occasionally use the above option to re-claim the heap on the RTC as well (I'll be adding/removing items on there every so often).

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Heap Fragmentation and Deep Sleep

Postby ESP_igrr » Fri Oct 26, 2018 12:14 pm

No, the power domain of RTC data memory is ESP_PD_DOMAIN_RTC_SLOW_MEM.

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: Heap Fragmentation and Deep Sleep

Postby czuvich » Fri Oct 26, 2018 1:21 pm

Thank you!

Who is online

Users browsing this forum: aliarifat794, Google [Bot] and 89 guests