Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Memory leak each loop at IwIP: 2 LM & HB (not at 1.4 HB) #7059

Closed
Assignees
d-a-v
@civilman2006

Description

@civilman2006
  • Hardware: ESP8266EX

  • Core Version: SDK:2.2.2-dev(38a443e)/Core:2.6.3=20603000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-16-ge23a07e/BearSSL:89454af

  • Development Env: Arduino IDE

  • Operating System: Windows

  • Module: LOLIN Wemos D1 mini Pro & Wemos D1 r2 mini

  • Flash Size: 16MB

  • lwip Variant: v2 Lower Memory and Higher Bandwidth

  • Flash Frequency:40Mhz

  • CPU Frequency:80Mhz

  • Upload Using:SERIAL

  • Upload Speed: 460800

At v2 Lower Memory and Higher Bandwidth I sawmemory leak each LOOP - 32 bytes or more. Try many options, with or without debug and so on... After ~26 minutes of run ESP goes to :oom and reboot with dump. Sometimes one or two or three loops go without a leak, but than mem leak continues.

If Iswitch to IwIP variant 1.4 Higher Bandwidth - memory leakstops and all work fine!
( SDK:2.2.2-dev(38a443e)/Core:2.6.3=20603000/lwIP:1.4.0rc2/BearSSL:89454af - that variant work fine) I can provide debug log but it will be the same as below, exclude memory leak.

#include<PubSubClient.h>#include<ESP8266WiFi.h>#defineESP8266#defineDEBUG1constchar* ssid ="zzzzzz";constchar* password ="xxxxxxx";constchar* mqtt_server ="111.222.222.222";constchar* mqtt_user ="zzzz";constchar* mqtt_pass ="zzzz";constchar* mqtt_clientId ="gost-temp";constchar* mqtt_ping_topic ="apr/home/ping";constchar* mqtt_online_message ="online";constchar* mqtt_last_will ="offline";constchar* mqtt_topic_base ="apr/home/";constint ping_time =30;bool firstRun =true;WiFiClient espClient;PubSubClientclient(espClient);uint32_t originalram;unsignedlong lastMeasure =0;voidsetup_wifi() {int zz =0;delay(10);#ifdef DEBUG  Serial.println();  Serial.print("Connecting to");  Serial.println(ssid);#endif  WiFi.mode(WIFI_STA);  WiFi.begin(ssid, password);delay(500);while (WiFi.status() != WL_CONNECTED) {delay(100);#ifdef DEBUG    Serial.print(".");#endif    zz=zz+1;if (zz >=100) {      ESP.restart();    }    Serial.print(zz);  }#ifdef DEBUG  Serial.println("");  Serial.print("WiFi connected - ESP IP address:");  Serial.println(WiFi.localIP());#endifdelay(1000);}voidreconnect() {delay(500);while (!client.connected()) {#ifdef DEBUG    Serial.print("Attempting MQTT connection...");#endif    String mqtt_clientIdRand = mqtt_clientId;    mqtt_clientIdRand +=String(random(0xffff), HEX);if (client.connect(String(mqtt_clientIdRand).c_str(), mqtt_user, mqtt_pass, (String(mqtt_ping_topic)).c_str(),0,1, mqtt_last_will)) {#ifdef DEBUG      Serial.println("connected");#endif    }else {#ifdef DEBUG      Serial.print("failed, rc=");      Serial.print(client.state());      Serial.println(" try again in 5 seconds");#endifdelay(5000);    }  }}voidsetup() {randomSeed(millis());  Serial.begin(115200);setup_wifi();  client.setServer(mqtt_server,1883);if (!client.connected()) {reconnect();  }  client.loop();  client.publish(mqtt_ping_topic, mqtt_online_message);  client.loop();  originalram = ESP.getFreeHeap();}voidloop() {if ((millis() - lastMeasure) > (ping_time *1000)) {    lastMeasure =millis();    client.loop();    client.publish(mqtt_ping_topic, mqtt_online_message);    client.loop();uint32_t ram = ESP.getFreeHeap();    Serial.printf("RAM: %d  change %d\n", ram, (ram - originalram ));  }delay(30);}

Debug log:

07:49:35.414 -> SDK:2.2.2-dev(38a443e)/Core:2.6.3=20603000/lwIP:STABLE-2_1_2_RELEASE/glue:1.2-16-ge23a07e/BearSSL:89454af07:49:35.414 -> 07:49:35.414 -> Connecting to XXXXX07:49:35.414 -> bcn 007:49:35.414 -> del if107:49:35.414 -> usl07:49:35.414 -> mode : sta(84:f3:eb:db:5a:3c)07:49:35.414 -> add if007:49:35.586 -> wifi evt: 807:49:36.171 -> .1.2wifi evt: 207:49:36.378 -> .3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23scandone07:49:39.389 -> state: 0 -> 2 (b0)07:49:39.389 -> .24state: 2 -> 3 (0)07:49:39.389 -> state: 3 -> 5 (10)07:49:39.389 -> add 007:49:39.389 -> aid 107:49:39.389 -> cnt 07:49:39.492 -> .2507:49:39.492 -> connected with XXXXXX, channel 607:49:39.561 -> dhcp client start...07:49:39.561 -> wifi evt: 007:49:39.561 -> .26ip:192.168.88.122,mask:255.255.255.0,gw:192.168.88.107:49:39.596 -> wifi evt: 307:49:39.666 -> .2707:49:39.666 -> WiFi connected - ESP IP address: 192.168.88.12207:49:41.182 -> Attempting MQTT connection...[hostByName] Host: 111.111.111.111 is a IP!07:49:41.182 -> :ref 107:49:41.216 -> :wr 70 007:49:41.216 -> :wrc 70 70 007:49:41.216 -> :ack 7007:49:41.216 -> :rn 407:49:41.216 -> :c0 1, 407:49:41.216 -> connected07:49:41.216 -> :wr 23 007:49:41.216 -> :wrc 23 23 007:49:41.285 -> :ack 2307:49:49.372 -> pm open,type:2 007:50:03.705 -> :rcl07:50:03.705 -> :abort07:50:05.117 -> RAM: 50008  change 129607:50:35.151 -> RAM: 49976  change 126407:51:05.188 -> RAM: 49944  change 123207:51:35.216 -> RAM: 49944  change 123207:52:05.217 -> RAM: 49944  change 123207:52:35.249 -> RAM: 49880  change 116807:53:05.287 -> RAM: 49816  change 110407:53:35.307 -> RAM: 49784  change 107207:54:05.336 -> RAM: 49784  change 107207:54:35.374 -> RAM: 49688  change 97607:55:05.382 -> RAM: 49560  change 84807:55:35.429 -> RAM: 49464  change 75207:56:05.438 -> RAM: 49464  change 75207:56:35.483 -> RAM: 49336  change 62407:57:05.512 -> RAM: 49080  change 36807:57:35.547 -> RAM: 48856  change 14407:58:05.566 -> RAM: 48648  change -6407:58:35.574 -> RAM: 48488  change -22407:59:05.604 -> RAM: 48008  change -70407:59:35.638 -> RAM: 47528  change -118408:00:05.669 -> RAM: 47368  change -134408:00:35.683 -> RAM: 47176  change -1536

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp