mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-26 05:09:19 +00:00
This is both a feature and an optimization. Feature: Adjustable size of the internal storage in esp_event queue, currently used by ISR posting, as they wont be able to make a malloc. Optimization: When non-isr is posting an event, use the inernal storage in the struct instead of always allocating a new heap for the data. Most events in esp-idf only contains a few bytes event information, and we have that allocation payed for anyway. This solved in a big part our memory fragmentation issue, as events happens freqvently and used to create small memory allocations for just 4 bytes, and then in the event handler we usually allocated a bigger chunk of heap for our feature. When returning from the event handler, the 4 byte allocation was freed, leaving a hole in the heap. Merges: https://github.com/espressif/esp-idf/pull/17797