From 9cdc6f52e04a9894d59e1a481b979787adc05b3f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 5 Apr 2026 13:00:14 -1000 Subject: [PATCH] Skip zero-init of RtcCrashData to save 15 bytes IRAM --- esphome/components/esp8266/crash_handler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/esp8266/crash_handler.cpp b/esphome/components/esp8266/crash_handler.cpp index 78b7e176fca..2833e0943d3 100644 --- a/esphome/components/esp8266/crash_handler.cpp +++ b/esphome/components/esp8266/crash_handler.cpp @@ -237,7 +237,9 @@ void crash_handler_log() { // the device restarts. We scan the full stack for code addresses and store // them in RTC user memory (which survives software reset). extern "C" void IRAM_ATTR custom_crash_callback(struct rst_info *rst_info, uint32_t stack, uint32_t stack_end) { - RtcCrashData data = {}; + // No zero-init — only magic, epc1, and backtrace[0..count-1] are read. + // Saves the IRAM cost of a 72-byte zero-init loop. + RtcCrashData data; // NOLINT(cppcoreguidelines-pro-type-member-init) uint8_t count = 0; auto *scan = reinterpret_cast(stack);