This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129ENCPDT: Tracking heap usage in run-time and printing it on console

Part Number: TM4C129ENCPDT

Hi All,

I want to track the heap usage of my code and printing it on the console like how much heap is used and how much is left. 

I tried this but did not work. https://e2e.ti.com/support/legacy_forums/embedded/tirtos/f/355/t/468277#pi320995filter=all&pi320995scroll=false

I am using TI RTOS 2.16.1.14 and xdc tool 3.32.00.

Thanks

  • Hi Akhilesh,

    You can call Memory_getStats to get the totalSize, totalFreeSize, and largestFreeSize. If you what this information on the the default system heap, you can provide NULL as the first parameter (i.e. IHeap_Handle)? Note: the default system heap is used when you do malloc or Memory_alloc(NULL, ...).

    Once you have the information, you can print it to the console via System_printf. Please note that displaying characters on the CCS console can impact real-time performance since the target is paused (to allow CCS to read the memory) when this occurs.

    Todd

  • Hi Todd,

    Thanks. It's working now. Is there any way to track stack usage also? This way I can check whole RAM usage. 

    Akhilesh

  • I got it from kernel document. Thanks