Hendrik Lipka
/
malloc_test
program to find out whether malloc() returns NULL on a failed call or not
Diff: main.cpp
- Revision:
- 0:77b549539791
- Child:
- 1:602fea3e6f8b
diff -r 000000000000 -r 77b549539791 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 21 20:29:11 2010 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" + +#define MALLOC_SIZE 0x2000 + +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +int main() { + led1=0; + led2=0; + led3=0; + led4=0; + printf("doing malloc 1\n"); + malloc(MALLOC_SIZE); + led1=1; + printf("doing malloc 2\n"); + malloc(MALLOC_SIZE); + led2=1; + printf("doing malloc 3\n"); + malloc(MALLOC_SIZE); + led3=1; + printf("doing malloc 4\n"); + malloc(MALLOC_SIZE); + led4=1; + printf("finished\n"); +}