Hendrik Lipka
/
malloc_test
program to find out whether malloc() returns NULL on a failed call or not
Diff: main.cpp
- Revision:
- 1:602fea3e6f8b
- Parent:
- 0:77b549539791
--- a/main.cpp Tue Dec 21 20:29:11 2010 +0000 +++ b/main.cpp Sat Jan 01 22:38:54 2011 +0000 @@ -1,28 +1,24 @@ -#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"); -} +#include <stdio.h> +#include "mbed.h" + +#define MALLOC_SIZE 0x2000 + +class C2: Base +{ + public: + C2(int a){_a=a;} + private: + int _a; +}; + +C2 a(1); +C2 b(2); + +int main() { + printf("doing test\n"); + malloc(MALLOC_SIZE); + malloc(MALLOC_SIZE); + malloc(MALLOC_SIZE); + malloc(MALLOC_SIZE); + printf("finished\n"); +}