How to free the RAM(heap) of gotten by the FreeRTOS_CLIRegisterCommand()?

Hi everyone,

I use the FreeRTOS_CLIRegisterCommand() function to implement CLI interface of my product.

However, I cannot understand how to release heap area gotten by FreeRTOS_CLIRegisterCommand() function.

There is below pvPortMalloc() operation in FreeRTOS_CLIRegisterCommand() function.
And I need to call the function multiple times to register the CLI command.
Then the function got the each command of heap area.

However, I could not find the way to release these heap area after the system finished using CLI.

How do I solve this issue?

Can you use FreeRTOS_CLIRegisterCommandStatic instead so that you can manage the memory in application?

1 Like

Hi Aggarg,

Thank you for your reply. It’s good solution!
However, the CLI lib that I am using version FreeRTOS+CLI V1.0.4 doesn’t have that function.
But I could understand your proposal. It will be solved by your idea.

This is the function I meant - FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c at 000c005ceed37605a3c146459acdf605ec90919e · FreeRTOS/FreeRTOS · GitHub.