Production3000 / mvp3000esp

Rapid prototyping/MVP framework for sensor applications.
Apache License 2.0
2 stars 1 forks source link

The growing linked list crashes on ESP32 #9

Closed ferdinand0815 closed 1 month ago

ferdinand0815 commented 3 months ago

not clear where

It crashes on ESP32 when linked list can grow ... (~52.5k free heap, 3% frag?, size ~1550) It does not leak when it does not grow ...

Memory fragmentation seems awfully wrong, declining with increasing memory usage. Obviously there are two heaps, right?

ferdinand0815 commented 3 months ago

Fixed in dev branch.

The ESP32 has two cores, with separate heaps. If a thread (? linked list) allocates a lot of memory it seems to fill up the heap of the core it runs on. The getMaxAllocHeap() then still indicates a rather large allocatable memory. This is however on the other core. Best indicator is the shrinking difference between free and largest allocatable memory. It starts at 50% allocatable, because half of total for each core. It goes to >99% allocatable, with one heap quasi full, the other having all the space.