1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00
Earle F. Philhower, III 4a958c8444
Record last failed alloc, dump on a panic (#4220)
At runtime, whenever a realloc, malloc, calloc, or new call fails to
find enough memory, record the calling function and size requested.
Does not print anything or call any heavyweight functions on this, as it
is legal to return NULL to an alloc-type call.

If the main application handles this NULL properly, there should be no
panic and nothing different will happen.

If the main application panics() at any later point in time, this record
will be printed out as part of the crash log for processing with an
updated EspExceptionDecoder.java.

This adds 2-3 instructions overhead in the normal case, and around 10-12
instructions in the failing case, and requires an additional 8 bytes of
.BSS to function.

Only a single address is kept, the final failing malloc-type function call
before a panic, but it is trivial to extend to a fifo with little overhead
in the common, non-failing case.
2018-03-17 07:51:32 -07:00
..