Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By Lucaspp
#21859
ReinholdHiller wrote:In clientcontext.h I changed line 70 and following (the following if ()... is now useless, but for a test.) to:

err = tcp_close(_pcb);
tcp_abort(_pcb);
if(err != ERR_OK) {

This fixes the "memory leak" and does not seem to harm the Webserver example.


Thanks for helps us in this forum. You are making very good job. There is a new ClientContext.h version and I cannot find where I have to change it.

Could somebody help me to get the right place in the new version?

Thanks and best regards
User avatar
By Lucaspp
#22005
ReinholdHiller wrote:In clientcontext.h I changed line 70 and following (the following if ()... is now useless, but for a test.) to:

err = tcp_close(_pcb);
tcp_abort(_pcb);
if(err != ERR_OK) {

This fixes the "memory leak" and does not seem to harm the Webserver example.


Thanks for your help. I could figure it out. Modification is made for the current file release at line 64.

ClientContext.h

64 err = tcp_close(_pcb);
65 tcp_abort(_pcb); // Modification 28-06-2015
66 if(err != ERR_OK) {
67 DEBUGV(":tc err %d\r\n", err);
68 tcp_abort(_pcb);
69 err = ERR_ABRT;

Very good Jop.

Best regards
User avatar
By Serge M
#84249 As for now both esp32, esp8266 cores have same issue with memory leaks caused by internal arrays _postArgs, _currentArgs which never disposed. Authors should start at junior positions... :lol:

To work around one may want to inherit from ESP8266WebSever class (or WebServer with esp32) and inplement a destructor similar to this:

virtual ~MyWebServer()
{
if (this->_currentArgs)
{
delete[] this->_currentArgs;
this->_currentArgs = nullptr;
}

if (this->_postArgs)
{
delete[] this->_postArgs;
this->_postArgs = nullptr;
}
}

That's it.