initial test app that shows potential memory usage by mbed-rtos
Dependencies: mbed-rtosMemoryTest mbed
heapsize.hpp@0:9a0840718117, 2014-12-09 (annotated)
- Committer:
- dmatsumoto
- Date:
- Tue Dec 09 18:42:05 2014 +0000
- Revision:
- 0:9a0840718117
initial test app that shows potential memory usage by mbed-rtos
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dmatsumoto | 0:9a0840718117 | 1 | #ifndef __HEAPSIZE_HPP__ |
dmatsumoto | 0:9a0840718117 | 2 | #define __HEAPSIZE_HPP__ |
dmatsumoto | 0:9a0840718117 | 3 | |
dmatsumoto | 0:9a0840718117 | 4 | unsigned long heapSize() |
dmatsumoto | 0:9a0840718117 | 5 | { |
dmatsumoto | 0:9a0840718117 | 6 | char stackVariable; |
dmatsumoto | 0:9a0840718117 | 7 | void *heap; |
dmatsumoto | 0:9a0840718117 | 8 | unsigned long result; |
dmatsumoto | 0:9a0840718117 | 9 | heap = malloc(4); |
dmatsumoto | 0:9a0840718117 | 10 | result = (uint8_t*)&stackVariable - (uint8_t*)heap; |
dmatsumoto | 0:9a0840718117 | 11 | free(heap); |
dmatsumoto | 0:9a0840718117 | 12 | return result; |
dmatsumoto | 0:9a0840718117 | 13 | } |
dmatsumoto | 0:9a0840718117 | 14 | |
dmatsumoto | 0:9a0840718117 | 15 | #endif |