Add heap pressure management for BLE and rendering
Prevent OOM aborts by shedding BLE stack when free heap drops below 24KB before rendering. Lower BLE start threshold from 100KB to 80KB to match steady-state heap levels (~84KB). Reserve vector capacity upfront in page parsing to avoid reallocation crashes on fragmented heaps. Gate background section builds on heap availability.
This commit is contained in:
@@ -148,6 +148,10 @@ std::unique_ptr<Page> Page::deserialize(HalFile& file) {
|
||||
|
||||
uint16_t count;
|
||||
serialization::readPod(file, count);
|
||||
// Reserve up front: growth-by-doubling needs old + new capacity live at once and
|
||||
// reallocates repeatedly — a field crash (bad_alloc -> abort under -fno-exceptions)
|
||||
// hit exactly this append path on a heavily fragmented heap.
|
||||
page->elements.reserve(count);
|
||||
|
||||
for (uint16_t i = 0; i < count; i++) {
|
||||
uint8_t tag;
|
||||
|
||||
Reference in New Issue
Block a user