lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] how to correctly release memory?


From: boter
Subject: [lwip-users] how to correctly release memory?
Date: Mon, 9 Jan 2006 14:54:43 -0800

I write a simple function using the lwip api .  the function is followed.
 
static void vProcessTCPConnection( struct netconn *pxNetCon )
{
struct netbuf *pxRxBuffer;
portCHAR *pcRxString;
unsigned portSHORT usLength;
 
      while((pxRxBuffer = netconn_recv( pxNetCon )) != NULL)
      {
            netbuf_data(pxRxBuffer, ( void * ) &pcRxString, &usLength);
            netconn_write(pxNetCon, pcRxString, usLength, NETCONN_COPY);
            //memp_free(MEMP_NETBUF, pxRxBuffer);
      }
      netbuf_delete( pxRxBuffer );
      netconn_close( pxNetCon );
}
 
   after I run the function , I connect to target running the funciton from a pc.
I input some characters, the pc endpoint will send these characters to target.
after the target received character, then send back .
   I found I only send 4 times. if I add memp_free(MEMP_NETBUF, pxRxBuffer);
I can send 16 times.
  
   Can anybody tell me how to correctly release the memory ?
 
thanks
Boter


reply via email to

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