-->
Page 1 of 1

connect and disconnect on loop - losing memory

PostPosted: Fri Apr 01, 2016 9:53 am
by Fabio
Hi, i am investigating why esp freezes after some reconnection

To do so, I've build this loop and noticed that after each connection I lose some heap space.

I am missing something? Is it common with you guys? I am using 2.1.0-rc2

Code: Select all       const char* host = "google.com";
   WiFiClient c;
   for (int i =0; i< 100; i+=1) {
      Serial.print (i);
      Serial.print ("-");
      Serial.println (ESP.getFreeHeap());
      if (c.connect (host,80)) {
         delay (100);
         c.flush ();
         c.stop ();
         delay (100);
      } else {
         Serial.println ("connection refused");
      }
   }


output:

Code: Select all0-30616
1-30408
2-30224
3-30040
4-29856
5-29672
6-29488
7-29304
8-29120
9-28936
...
91-14032
92-13848
93-13664
94-13480
95-13296
96-13112
97-12928
98-12744
99-12560

Re: connect and disconnect on loop - losing memory

PostPosted: Sun Apr 03, 2016 9:01 pm
by Fabio
this modification fix the issue

https://github.com/esp8266/Arduino/issu ... -116816950

it seems that it is not in the master branch yet