Details
Description
When large assemblies, e.g. 504 bytes each, are registered and I/O data is accessed via explicit CL3 or UCMM, the stack will be stuck in an endless loop calling TCP_Write().
Seems as we allocate to much buffers and lwIP may run out of memory in certain situations:
1) One buffer per CL3 instance (1500 bytes), malloced at initialization time
memcpy'd to
2) One buffer (variable size), LwIP_Buf_Alloc'd in EipEncapCl3_SendResponse()
memcpy'd to
3) One buffer (variable size), implicitly allocated in LwIP_Socket_Write()
We are too short on resources for large sends. We should avoid the LwIP_Buf_Alloc() of buffer 2) and directly use buffer 1) instead by means of LwIP_Buf_Ref().
This of course forces us to think about the lifecycle of especially the UCMM connection again, since TCP-sending happens asynchronously and we must not free that buffer 1) until the data was passed to the lwIP layer.