|
From: | Krzysztof Wesołowski |
Subject: | Re: [lwip-users] memory leak ? |
Date: | Thu, 4 Jun 2015 14:44:43 +0200 |
Hi Noam!
From earlier discussion on this list, I learned that for this purpose
one may schedule a callback into the LWIPs internal task using
tcpip_callback() or tcpip_callback_with_blocking(). Both queue your
function and its arguments for execution from within the main Lwip task
context. I'm not sure if this is applicable here, but if so, I would
favour the callback solution as yours might introduce dead locks in case
tcp_sndbuf() blocks. This type of errors are comparably difficult to
find and likely to happen if eg. an other task is used to free buffers
after transmission completed.
Jan
On 04.06.2015 14:18, Noam weissman wrote:
> Hi,
>
> PROBLEM SOLVED :-)
>
> As mentioned earlier by Sergio we should not call LwIP code from within
> other threads.
>
> I must call tcp_write and other functions from a separate thread. This
> is the implementation.
>
> My TCP stack has the highest task priority in the system. As a result
> calling tcp_write or any other
> LwIP function may cause unpredictable LwIP internal code problems.
>
> I added taskENTER_CRITICAL(); and taskEXIT_CRITICAL();
> Function calls to the portion of code that call tcp_write etc.. this
> synchronizes the threads
> Interaction and solved the problem I faced completely.
>
> For example:
>
> taskENTER_CRITICAL();
> {
> AvailableSpace = tcp_sndbuf(ts->pcb);
> }
> taskEXIT_CRITICAL();
>
>
> Thanks for your insight.
>
> BR,
> Noam.
>
> -----Original Message-----
> From: lwip-users-bounces+noam=address@hidden
> [mailto:lwip-users-bounces+noam=address@hidden] On Behalf Of
> Sergio R. Caprile
> Sent: Thursday, June 04, 2015 12:02 AM
> To: address@hidden
> Subject: Re: [lwip-users] memory leak ?
>
> Tx: yes
> Rx: if you free them properly then they shouldn't be scarce. Have you
> tested this ?
>
> I'm not familiar with lwIP under RTOS except that you must adhere to the
> general rule of not calling the stack from different threads.
> You should check your port with a known good application first. Try
> echo, for example, or netio; both are available in the contrib tree (and
> there is nice patch for netio sent by youknowho)
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> ************************************************************************
> ************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals &
> computer viruses.
> ************************************************************************
> ************
>
>
>
>
>
>
> ************************************************************************************
> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
> ************************************************************************************
>
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
[Prev in Thread] | Current Thread | [Next in Thread] |