|
From: | Sebastian Gonzalez |
Subject: | Re: [lwip-users] Receive path stuck due to pbuf_alloc returning NULL |
Date: | Fri, 31 May 2013 01:43:31 -0700 (PDT) |
I don't know if this still applies but a while ago there was a memory
leak in the AT91/FreeRTOS implementation of ethernetif_input() when
passing the pbuf to netif->input
I have this code:
switch( htons( ethhdr->type ) )
{
/* IP packet? */
case ETHTYPE_IP:
case ETHTYPE_ARP:
case ETHTYPE_IPV6:
/* pass to network layer */
if (pxNetIf->input( p, pxNetIf ) != ERR_OK)
{
pbuf_free( p );
#if LINK_STATS
lwip_stats.link.drop++;
lwip_stats.link.err++;
#endif /* LINK_STATS */
}
break;
default:
pbuf_free( p );
#if LINK_STATS
lwip_stats.link.drop++;
lwip_stats.link.proterr++;
#endif /* LINK_STATS */
p = NULL;
break;
}
The key is to free the pbuf not only if packet type is unrecognized,
but also if pxNetIf->input fails (this is where I had my memory leak).
Cheers
Ivan
> Date: Thu, 30 May 2013 02:14:04 -0700 (PDT)
> From: Sebastian Gonzalez <[hidden email]>
> To: [hidden email]
> Subject: Re: [lwip-users] Receive path stuck due to pbuf_alloc
> returning NULL
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I am still having problems, but it's true that it takes more time for
> the
> system to stop receiving under the same stress tests.
> I made a little test that includes a semaphore that is set everytime a
> pbuf
> is allocated and is released every time the packet is processed, but
> with no
> positive results. Wether not every pbuf is freed in the TCP/IP thread
> after
> being processed, or there is a memory leak as Ivan sugested.
> Is there any way to release all the memory? I don't mind having to
> close my
> application sockets if the system is restored and I can reopen them.
>
> Thanks.
>
> Sebestian.
_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
If you reply to this email, your message will be added to the discussion below:http://lwip.100.n7.nabble.com/Receive-path-stuck-due-to-pbuf-alloc-returning-NULL-tp21461p21490.html
ADVERTENCIA
La información contenida en este correo electrónico, es
de carácter privado y confidencial, siendo para uso
exclusivo de su destinatario. Si usted no es el
destinatario correcto, o ha recibido esta comunicación
por error, le informamos que está totalmente prohibida
cualquier divulgación, distribución o reproducción de
esta comunicación según la legislación vigente y le
rogamos que nos lo notifique inmediatamente, procediendo
a su destrucción sin continuar su lectura.
Su dirección de correo electrónico, así como el resto de
los datos de carácter personal que nos facilite, podrían
ser objeto de tratamiento automatizado en nuestros
ficheros, con la finalidad de gestionar la agenda de
contactos de BY TECHDESIGN,S.L. Vd. podrá en cualquier
momento ejercer sus derechos de acceso, rectificación,
cancelación y oposición según la Ley Orgánica 15/1999
mediante notificación escrita a la siguiente dirección:
CALLE TOMAS EDISON 5 28500 ARGANDA DEL REY.
[Prev in Thread] | Current Thread | [Next in Thread] |