Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 4 months ago.
How to use mbed_stats_heap_get in mbed-os?
Hello, I have compiled the mbed-os lib for my target. There I ran into memory troubles and want to check the available heap size now. In the mbed-os sources, I have defined MBED_HEAP_STATS_ENABLED directly in mbed_alloc_wrappers.cpp . But the result for calliing mbed_stats_heap_get is a constant value for 'heap reserved' and all other values are zero. What am I doing wrong? Btw, what is the proper way to pass the define for building the lib? As I understand it should be defined in a json file. Can someone give me an example for that?
Edit: Done some more tests: a malloc() does not call the wrapper function 'wrapmalloc_r' in mbed_alloc_wrappers.cpp. I'm using GCC_CR, could this be the reason? What else can I test?
got it! The linker switches for the wrapper funtions were missing in my exported project: