Need Help regarding Netconn Memory Leak Issue
Posted: Thu Nov 23, 2017 1:33 pm
Hello,
I implemented simple server using lwip netcon My server code is as following:
When I send request first time free heap size is 223520,
When I send request second time my free heap size is become 222940,
when I send request 3rd time my free heap size is become 222992.
continuously my heap size is reducing as I send request continuously.
My questions are:
Why memory is consume at every request? Is it Library issue or am I doing anything wrong?
How to manage this memory consumption?
I implemented simple server using lwip netcon My server code is as following:
Code: Select all
static void server(void *pvParameters)
{
printf("\n system_get_free_heap_size in starting of server task =%d\n\n\n",system_get_free_heap_size());
struct netconn *conn , *newconn;
err_t err;
conn = netconn_new(NETCONN_TCP);
err= netconn_bind(conn, NULL, 80);
if (err == ERR_OK) {printf("\nsocket bound\n");}
netconn_listen(conn);
do{
printf("\nsystem_get_free_heap_size before accept =%d\n\n\n",system_get_free_heap_size());
err = netconn_accept(conn, &newconn);
printf("\nsystem_get_free_heap_size after accept =%d\n\n\n",system_get_free_heap_size());
if (err == ERR_OK)
{
printf("connection accept\n");
}
printf("\nsystem_get_free_heap_size befor close newconn =%d\n\n\n",system_get_free_heap_size());
err=netconn_close(newconn);
if(err!=ERR_OK) printf("\n new con not closed\n");
printf("\nsystem_get_free_heap_size after close and before delete newconn =%d\n\n\n",system_get_free_heap_size());
err_t err_newconn_d=netconn_delete(newconn);
if (err_newconn_d != ERR_OK) printf("newconn not delete succesfully\n");
printf("\nsystem_get_free_heap_size in end of http_server task =%d\n\n\n",system_get_free_heap_size());
} while(err == ERR_OK);
netconn_close(conn);
printf("conn is close\n");
netconn_delete(conn);
printf("http exit\n");
}
When I send request second time my free heap size is become 222940,
when I send request 3rd time my free heap size is become 222992.
continuously my heap size is reducing as I send request continuously.
My questions are:
Why memory is consume at every request? Is it Library issue or am I doing anything wrong?
How to manage this memory consumption?