FreeRTOS+TCP require calling to vPortFree() and should using heap_1


I’m want to add FreeRTOS+TCP to project who work with heap_1.c
I thought that using FREERTOS_SO_REUSE_LISTEN_SOCKET I will be able to use one socket only.

Apparently it seems impossible. When the socket is closed, the function vPortFree is called, which is illegal in heap_1. There are calls to vEventGroupDelete, for example.

  1. Is there a way to do it? The logic of reusing socket suggest that the same resources can be used without delete, as long as we stay with one (or N predefined number) socket.

  2. If not, it should be clear in the documentation that FreeRTOS+TCP shouldn’t be used with heap_1


You are right in that you cannot use FreeRTOS+TCP with heap_1. We have some feature requests to be able to use FreeRTOS+TCP with statically allocated memory only, but this will take some time to implement and will result in quite a restrictive system as you will have to know in advance how many sockets are required.

I normally use heap_4 or heap_5 for +TCP projects.
FREERTOS_SO_REUSE_LISTEN_SOCKET is useful for low-RAM projects: the space allocated for a server socket is passed to the client socket. Only when the connection is finished, a new server socket will be created.

So is it possible to edit the documentation to make it clear?
I found this only after I was done with importing the TCP stack…

That’s why I thought there will be no problem releasing the resources and close the socket, without delete or free.