Hi @andréluis,
Heap3 scheme only wraps the standard C library malloc() and free() functions to provide thread safety. In this case, when you use pvPortMalloc(), the function will use malloc() to allocate memory.
It's not like vPortFree() isn't working. It is, but you will not see the change in the Heap and Stack Usage option because as per my understanding, free() doesn't delete nor clear the memory, it only marks the space as available for future malloc() allocations.
You can see this by yourself by allocating memory using pvPortMalloc(), then free it with vPortFree(). Then immediately allocate the same amount of memory, you will see that the Heap and Stack Usage will increase only once and not twice.
For more information regarding this, I would recommend you take a look to the FreeRTOS documentation.
I hope this helps.
Regards,
Daniel.
Hi,
Could you please help me with the following infromation?
What SDK version are you using?
Are you trying a SDK example?
How you are making and verifying the heap change?
If I'm understanding correct you would like to use heap 3, but in your project the heap in use in another one, am I right?
Regards,
Daniel.
Hi Daniel
What SDK version are you using?
I'm using the SDK 2.14 of MIMXRT1060-EVK
Are you trying a SDK example?
Yes. I'm working with evkbmimxrt1060_lwip_ipv4_ipv6_echo_freertos.
How you are making and verifying the heap change?
I attach an image showing how i making the verify of the heap.
If I'm understanding correct you would like to use heap 3, but in your project the heap in use in another one, am I right?
In my project it's using heap_3.c.
Thanks for the reply.
I'm sorry for the misunderstanding, I thought you were trying to change the FreeRTOS Heap implementation.
Is there a specific path to get this behavior? If that's the case, could you please tell me how you are running the example so I can try to replicate it on my side?
Regards,
Daniel.
Hello Daniel, in the picture attach i put a breakpoint when my application call the vPortFree. In my application, i send to him some blocks, like function blocks of PLC, and the value of my heap increase because the blocks. But, when i remove the blocks from my application, the value of the heap don't decreases, showing the same value. In the pictures i show the value before the dowload of the application, the process of download an application, update the value of the heap, download an empty application and the value of the heap don't change.
In other words, in the evkbmimxrt1060_lwip_ipv4_ipv6_echo_freertos SDK example, when you use vPortFree, you don’t see a change in the heap usage. The heap stays the same, am I correct?
Regards,
Daniel.
Hi @andréluis,
Heap3 scheme only wraps the standard C library malloc() and free() functions to provide thread safety. In this case, when you use pvPortMalloc(), the function will use malloc() to allocate memory.
It's not like vPortFree() isn't working. It is, but you will not see the change in the Heap and Stack Usage option because as per my understanding, free() doesn't delete nor clear the memory, it only marks the space as available for future malloc() allocations.
You can see this by yourself by allocating memory using pvPortMalloc(), then free it with vPortFree(). Then immediately allocate the same amount of memory, you will see that the Heap and Stack Usage will increase only once and not twice.
For more information regarding this, I would recommend you take a look to the FreeRTOS documentation.
I hope this helps.
Regards,
Daniel.