// Heap diagnostics that survive a reset : the reset reason and the allocations that failed before it. #pragma once namespace microbu::heap_diagnostics { /// Registers the failed-allocation hook. Call once, early in app_main. void install(); /// Failed allocations since boot (every heap, every size). A difference across an operation shows whether it ran /// out of memory, which asn1c and the Wi-Fi driver otherwise report as a decoding error or ESP_ERR_NO_MEM. unsigned failed_allocations(); /// Logs the reset reason and, if the previous run recorded failed allocations, the last one of them. /// Call once the log transport is up. void report_boot(); } // namespace microbu::heap_diagnostics