lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] memory leak ?


From: Jan Menzel
Subject: Re: [lwip-users] memory leak ?
Date: Thu, 04 Jun 2015 14:34:39 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

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: address@hidden
> [mailto: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
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]