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.

CCS/TM4C123GH6PM: How to dynamic allocate memory in Tiva-C

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Can someone tell me how to dynamic allocate memory using malloc function on TM4C123X Launchpad? Also, can someone show me an example too?

Thanks in advance.

  • Hello Hesham,

    To use malloc you will need to reserve heap space in the project settings as well:

    We don't have any examples using malloc though. I've personally not used it for embedded applications myself but there are some who prefer using it. The main thing to remember is practicing proper memory management so that you don't have any memory leaks.

  • Hesham Khaled said:
    Can someone tell me how to dynamic allocate memory using malloc function on TM4C123X Launchpad?

    Are you using the TI or GNU compiler?

    How the heap size is configured depends upon which compiler is used.