Memory leak with the function wget()
Posted: Wed Feb 17, 2016 8:36 am
Hi Mmiscool,
I'm just playing around with your latest version (1.81) and I discovered that, each time the wget() function is called, there are around 200 bytes of memory gone; this cause the ESP to crash after a while.
Looking inside your code, I discovered that the problem comes from the function FetchWebUrl() that, in turns, calls the function client.connect(), where the leak is generated.
Searching on internet, I discovered that there is a patch available on the framework; in particular the file "ClientContext.h" in the framework needs to be patched as below :
That file is located at :
C:\Documents and Settings\YOUR_NAME\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc1\libraries\ESP8266WiFi\src\include
You can find all the details here :
http://www.esp8266.com/viewtopic.php?f=28&t=3003&start=8
Hope you can include this into your next version.
Regards,
Cicciocb
I'm just playing around with your latest version (1.81) and I discovered that, each time the wget() function is called, there are around 200 bytes of memory gone; this cause the ESP to crash after a while.
Looking inside your code, I discovered that the problem comes from the function FetchWebUrl() that, in turns, calls the function client.connect(), where the leak is generated.
Searching on internet, I discovered that there is a patch available on the framework; in particular the file "ClientContext.h" in the framework needs to be patched as below :
Code: Select all
line 64 err = tcp_close(_pcb);
line 65 tcp_abort(_pcb); // that line needs to be included //
line 66 if(err != ERR_OK) {
line 67 DEBUGV(":tc err %d\r\n", err);
line 68 tcp_abort(_pcb);
line 69 err = ERR_ABRT;
That file is located at :
C:\Documents and Settings\YOUR_NAME\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.0.0-rc1\libraries\ESP8266WiFi\src\include
You can find all the details here :
http://www.esp8266.com/viewtopic.php?f=28&t=3003&start=8
Hope you can include this into your next version.
Regards,
Cicciocb