Closed
Description
Basic Infos
- This issue complies with the issue POLICY doc.
- I have read the documentation at readthedocs and the issue is not addressed there.
- I have tested that the issue is present in the current master branch (aka latest git).
- I have searched the issue tracker for a similar issue.
- If there is a stack dump, I have decoded it.
- I have filled out all fields below.
Platform
- Hardware: ESP-12
- Core Version: [76cda9b]
- Development Env: Arduino IDE
- Operating System: Ubuntu
Settings in IDE
-
Module: Adafruit HUZZAH
-
Flash Mode: qio
-
Flash Size: 4MB
-
lwip Variant: v2 Lower Memory
-
Reset Method: nodemcu
-
Flash Frequency: 40Mhz
-
CPU Frequency: 80Mhz
-
Upload Using: SERIAL
-
Upload Speed: 115200(serial upload only)
-
Exceptions: Disabled
Problem Description
With "Exceptions: Disabled" selected from the Arduino IDE.
A build using the new operator without (std::nothrow)
causes a crash, when out of memory.
Fails with "Abort called" and stack trace.
No opportunity to test for NULL.
This test sketch also fails with Arduino ESP8266 Core 2.5.0; however, it works (returns NULL) in Core 2.4.2.
And before rerunning each test, I did a git pull
against the branch and ran ./get.py
from the tools
directory.
MCVE Sketch
void setup() {
Serial.begin(115200);
delay(20);
Serial.printf("\nUp and running ...\n");
// char *p = new (std::nothrow) char[128000]; // This will return NULL
char *p = new char[128000]; //This fails with "Abort called" and stack trace
if (p == NULL) {
Serial.printf("\n\"new\" failed as it should! PASS!\n");
} else {
Serial.printf("\n\"new\" worked, it should not have!, FAIL!\n");
}
}
void loop() {
}
Debug Messages
Up and running ...
Abort called
>>>stack>>>
ctx: cont
sp: 3ffffdd0 end: 3fffffc0 offset: 01b0
3fffff80: 40201d52 00000014 3ffee294 4020a4d4
3fffff90: 3fffdad0 00000000 3ffee294 40201058
3fffffa0: feefeffe feefeffe 3ffee2bc 40201874
3fffffb0: feefeffe feefeffe 3ffe84f4 40100a41
<<<stack<<<
last failed alloc call: 4020A504(128000)
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v76cda9bd
~ld
Decoding stack results
0x40201d52: delay(unsigned long) at /home/mhightow/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_wiring.cpp line 57
0x4020a4d4: operator new[](unsigned int) at ../../../../../dl/gcc-xtensa/libstdc++-v3/libsupc++/new_opv.cc line 33
0x40201058: setup() at /home/mhightow/Arduino/test/nothrow3/nothrow3.ino line 14
0x40201874: loop_wrapper() at /home/mhightow/Arduino/hardware/esp8266com/esp8266/cores/esp8266/core_esp8266_main.cpp line 129
This issue may be related to #6251 (comment)
Metadata
Metadata
Assignees
Labels
No labels