Page 1 of 1
Heap Fragmentation and Deep Sleep
Posted: Sun Oct 21, 2018 4:48 pm
by czuvich
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!
Re: Heap Fragmentation and Deep Sleep
Posted: Sun Oct 21, 2018 10:16 pm
by WiFive
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.
Re: Heap Fragmentation and Deep Sleep
Posted: Tue Oct 23, 2018 2:29 am
by ESP_Sprite
That, or manually save whatever you need to save to RTC RAM.
Re: Heap Fragmentation and Deep Sleep
Posted: Thu Oct 25, 2018 5:50 pm
by czuvich
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).
Re: Heap Fragmentation and Deep Sleep
Posted: Fri Oct 26, 2018 12:14 pm
by ESP_igrr
No, the power domain of RTC data memory is ESP_PD_DOMAIN_RTC_SLOW_MEM.
Re: Heap Fragmentation and Deep Sleep
Posted: Fri Oct 26, 2018 1:21 pm
by czuvich
Thank you!