initial publsihed version, working. Tested on LPC1768 and Seed Arch BLE.
Dependencies: AvailableMemory mbed
Fork of AvailableMemory_HelloWorld by
The purpose of this tiny application is to measure Flash and RAM allocation of mbed OS.
lightly extended from
main.cpp@3:4d25cc6a3b98, 2014-11-27 (annotated)
- Committer:
- grassel
- Date:
- Thu Nov 27 17:23:37 2014 +0000
- Revision:
- 3:4d25cc6a3b98
- Parent:
- 2:1ec7d87c70e3
initial published version, working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
grassel | 2:1ec7d87c70e3 | 1 | #include "mbed.h" |
segundo | 0:804397913aa2 | 2 | #include "AvailableMemory.h" |
segundo | 0:804397913aa2 | 3 | |
grassel | 2:1ec7d87c70e3 | 4 | /* |
grassel | 2:1ec7d87c70e3 | 5 | The purpose of this tiny application is to measure FLASh and RAM allocation |
grassel | 2:1ec7d87c70e3 | 6 | of mbed OS. |
grassel | 2:1ec7d87c70e3 | 7 | |
grassel | 2:1ec7d87c70e3 | 8 | lightly extended from |
grassel | 2:1ec7d87c70e3 | 9 | http://developer.mbed.org/users/segundo/code/AvailableMemory_HelloWorld/file/be64cf93dcba/main.cpp |
grassel | 2:1ec7d87c70e3 | 10 | */ |
grassel | 2:1ec7d87c70e3 | 11 | |
grassel | 2:1ec7d87c70e3 | 12 | DigitalOut myled(LED1); |
segundo | 0:804397913aa2 | 13 | |
grassel | 2:1ec7d87c70e3 | 14 | int main() |
grassel | 2:1ec7d87c70e3 | 15 | { |
grassel | 2:1ec7d87c70e3 | 16 | myled = 1; |
grassel | 2:1ec7d87c70e3 | 17 | printf("before heap alloc: available: %d Bytes\r\n", AvailableMemory(1)); |
grassel | 2:1ec7d87c70e3 | 18 | int *i = new int[500]; |
grassel | 2:1ec7d87c70e3 | 19 | i[0]=4711; |
grassel | 2:1ec7d87c70e3 | 20 | i[499] = i[0]; |
grassel | 2:1ec7d87c70e3 | 21 | myled = !myled; |
grassel | 2:1ec7d87c70e3 | 22 | printf("after 500*int heap alloc: available: %d Bytes\r\n", AvailableMemory(1)); |
segundo | 0:804397913aa2 | 23 | } |