Hello All,
I'am testing dynamic memory usage on imxrt1176 on baremetal. When using standard C malloc() then free() functions, the allocated space is not released with the free function. The heap do not decrease:
Regards,
Ahmed.
Hi @ahmedhrabi ,
There's the feedback from the AE team.
The Usage of 'Heap and Stack Usage' displays the maximum value which allocated, the usage value will update when the current allocated space larger than the previous allocated space, not update when the current allocated space smaller than the previous allocated space. In fact, the allocated space is released with the free function.
Some test results is below:
(1) array = (int*)malloc(50* sizeof(int)); the Usage displays 5.18%.
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
In basic, I replicate the phenomenon you mentioned, further, I use the below code to find that MCUXpreso IDE can display the increasing heap usage.
I'll report the phenomenon to the IDE team for further checking soon later.
for(uint32_t i = 1; i < 5; i++)
{
int *array = (int*)malloc(32*sizeof(int)*i);
if (NULL == array)
{
return -1;
}
free(array);
array = NULL;
}
Have a great day,
TIC
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------