CORRUPT HEAP: Bad head at 0x... Expected 0xabba1234
What it looks like
CORRUPT HEAP: Bad head at 0x3ffb8f2c. Expected 0xabba1234 got 0x3ffb8f40 assert failed: multi_heap_free multi_heap_poisoning.c:259 (head != NULL)
What it means
The heap allocator found its own bookkeeping overwritten. Some earlier code wrote outside a block it allocated, or used a block after freeing it. The crash is reported at the next malloc or free, which is usually far from the real bug.
Likely causes
- Writing past the end of a buffer from malloc() or new[].
- Freeing the same pointer twice, or using it after free() or delete.
- Two tasks modifying the same String, vector or buffer at once.
How to fix it
- Call heap_caps_check_integrity_all(true) at points in your code to narrow down where the damage happens.
- Check every write into heap buffers for length.
- Protect data shared between tasks with a mutex.
Paste your full log
The lines around the error usually say more. Paste everything from the reset to the backtrace and the crash translator explains each part. It runs in your browser; nothing is sent anywhere.