mirror of
https://github.com/esphome/esphome.git
synced 2026-02-08 08:41:59 +00:00
fa1554cac04c694b7b0a1b7110e02e48ff5c91cb
Replace the temporary std::vector copy with in-place compaction using a read/write pointer pattern. This avoids a heap allocation+deallocation cycle during scheduler cleanup, reducing heap fragmentation on long-running ESP devices. The new approach compacts valid items forward in the existing vector, recycles removed items as they are encountered, then resizes the vector (no reallocation since size only shrinks). Same O(n) complexity, same behavior, zero allocations.
Description
Languages
C++
64.3%
Python
35.4%
C
0.2%
