Bug
Console::Poll() enforces ConsoleConfig::MaximumLineLength, but the backing std::string grows incrementally with push_back(). Under severe heap pressure this growth can throw std::bad_alloc; if exception allocation itself fails on ESP32, the process reaches std::terminate()/abort().
This was reproduced in EventConsole-Lab after ESP-NOW had already begun reporting allocation failures. The fatal backtrace resolved through std::string::push_back() -> ESPressio::Serial::Console::Poll() -> operator new -> std::terminate().
Expected
A configured bounded console line should allocate its bounded storage during initialization rather than introducing an avoidable allocation point while consuming an ordinary command.
Acceptance criteria
- Reserve the configured line capacity during
Console::Initialize().
- If the reservation cannot be satisfied, initialization fails cleanly rather than leaving a partially initialized console.
Poll() does not need to grow the input string for lines up to MaximumLineLength.
- Add regression coverage demonstrating that the configured capacity is established during initialization and retained through polling/clearing.
- Preserve existing maximum-line-length/discard semantics and public API behavior.
- Update CHANGELOG/documentation for the patch release candidate.
Bug
Console::Poll()enforcesConsoleConfig::MaximumLineLength, but the backingstd::stringgrows incrementally withpush_back(). Under severe heap pressure this growth can throwstd::bad_alloc; if exception allocation itself fails on ESP32, the process reachesstd::terminate()/abort().This was reproduced in EventConsole-Lab after ESP-NOW had already begun reporting allocation failures. The fatal backtrace resolved through
std::string::push_back()->ESPressio::Serial::Console::Poll()->operator new->std::terminate().Expected
A configured bounded console line should allocate its bounded storage during initialization rather than introducing an avoidable allocation point while consuming an ordinary command.
Acceptance criteria
Console::Initialize().Poll()does not need to grow the input string for lines up toMaximumLineLength.