lpcware

Memory Leak problem in LPC1788 with FreeRTOS 7.10 and LWIP1.41

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mstsai on Thu Nov 15 22:40:43 MST 2012
Dear All:

I have been working on the LPC1788 with FreeRTOS and LWIP in the past few weeks.  The system has 32MB of SDRAM.  So, I reserved 4MB to the LWIP.   Originally, I developed a TFTP client to send data to a remote server every few minutes.  The data size is about 150KB.  However, the system stopped sending packets to the server after few hours.  In order to identify the problem, I create a project with only one task, SNTP, in FreeRTOS.  I have set up the SNTP to acquire the time information from NTP server every 10 seconds.  The heap memory statistics is printed after each access to see how the heap is used.  I have discovered that for every NTP access, the used heap increases slightly, about 150 bytes.  The number keeps increasing.  The outputs are shown below.

If this is a type of memory leak problem, how do I identify the source of the leak and fix the problem?

Any suggestion would be appreciated.



MEM HEAP
        avail: 4194304
        used: 218144
        max: 219708
        err: 0
sntp_send_request: Sending request to server
2012/11/16-13:35:25
sntp_process: Fri Nov 16 05:35:25 2012
sntp_recv: Scheduled next time request: 10000 ms
....******* RTC IRQ Handler : 13:35:30 ********
.....
MEM HEAP
        avail: 4194304
        used: 218276
        max: 219840
        err: 0
sntp_send_request: Sending request to server
2012/11/16-13:35:35
sntp_process: Fri Nov 16 05:35:35 2012
sntp_recv: Scheduled next time request: 10000 ms
....******* RTC IRQ Handler : 13:35:40 ********
.....
MEM HEAP
        avail: 4194304
        used: 218408
        max: 219972
        err: 0
sntp_send_request: Sending request to server
2012/11/16-13:35:45
sntp_process: Fri Nov 16 05:35:45 2012
sntp_recv: Scheduled next time request: 10000 ms
....******* RTC IRQ Handler : 13:35:50 ********
.....
MEM HEAP
        avail: 4194304
        used: 218540
        max: 220104
        err: 0
sntp_send_request: Sending request to server
2012/11/16-13:35:56
sntp_process: Fri Nov 16 05:35:56 2012
sntp_recv: Scheduled next time request: 10000 ms
...

Outcomes