Mike Fiore
/
nucleo_new_test
test program demonstrating memory allocation failure on STMicro Nucleo F401RE
Diff: main.cpp
- Revision:
- 0:ffc1aff71c81
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Aug 26 15:42:04 2014 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +int main() { + char i = 0; + char* x[8]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("new %d\r\n", i); + x[i++] = new char[256]; + + printf("done\r\n"); +} \ No newline at end of file