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
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:
0-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