Mbed OS stack and heap memory usage

Hi, is there a way to track the memory usage in mbed OS? I need this information to choose the optimal stack and heap size for my target.
Thank you


ualloc contains tracking debug, please have a look at ualloc module, which has this code inside:

UALLOC_DEBUG_LOG is effectively reserved for tracing memory allocations
Tracing must be enabled via "yotta config":
    "debug": {
        "options": {
            "memory-trace": true
[TODO]: ualloc_debug_level probably needs better control with "yotta config"
const UAllocDebug_t ualloc_debug_level = UALLOC_DEBUG_LOG;
const UAllocDebug_t ualloc_debug_level = UALLOC_DEBUG_NONE;

Stack is used for static memory allocation and Heap for dynamic memory allocation, both stored in the computer’s RAM . More about…Stack and Heap