Page 1 of 1

Does esp32 has garbage collection?

Posted: Fri Apr 05, 2024 5:08 pm
by TimoFran
Hi all!
I'm running a simple esp32 program which reports free heap and min free heap (no real need but I liked that).

What I found is that at a certain point the min_free_heap went from about 1.82kb to about 62.5kb while the total free heap remained the same.

I'm getting the values using ESP.getFreeHeap() and ESP.getMinFreeHeap().

Can someone please explain why does the min free heap increased? I tought this could not happen.

Re: Does esp32 has garbage collection?

Posted: Sat Apr 06, 2024 2:16 pm
by liaifat85
It's possible that earlier in the program execution, the free heap dropped significantly lower than 62.5kb, and that was recorded as the min_free_heap value at that time. Then, as the program continued to run and memory was freed up, the min_free_heap value was not updated because the minimum threshold was never breached again.

Re: Does esp32 has garbage collection?

Posted: Sat Apr 06, 2024 4:33 pm
by lbernstone