Heap and Stack - nxp-mcuxpresso/vscode-for-mcux GitHub Wiki
A debug utility used to display the Stack and Heap allocation for baremetal applications.
This is represented as a view, located in NXP MCUXpresso extension. In order to have it populated with data, an active debug session is required.
Note: At the time of writing this documentation, the feature is working for pure baremetal application or for MCUXpresso SDK based projects using FreeRTOS or Azure RTOS ThreadX. The Zephyr based application are not providing Heap and Stack usage information yet.
The data is represented as a set of details for each memory block (heap and stack) as following:
- Block name (with percentage usage)
- Usage information (percent of usage, used size and free size in bytes)
- Last used address for that memory block (SP/MSP register for stack, or a special heap symbol used by the toolchain's library memory allocator)
- Memory range addresses (as typically given by special symbols defined in linker file (Ex. __StackTop, __StackLimit, __HeapLimit, __HeapBase)
If no so much level of details is required, user can also collapse the details so only allocation percentage can be seen.
While advancing through application at debug time, level of memory block usage will increase and a color coding is used to represent the status:
- Green color for [0%..70%] memory allocation.
- Yellow color for (70%..full) memory allocation.
- Red color (with Overflow mention) when no space is left for a new memory allocation.
Note: At the time of writing this documentation, the Overflow status for heap memory is not yet implemented. Also, if the heap is trying to allocate more than the available space, the allocation pointer will not increase anymore so the percentage of used memory will remain stuck at the last successful operation.
Disabling the feature
In order to have data populated, this view retrieves various data from target (registers or memory reading). In case you need to decrease the data traffic to the target, you may disable the feature from "Disable Heap and Stack monitoring" button from view's toolbar.
Pressing once again, it will re-enable the full functionality.