-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory Leak on WiFIClientSecure #6709
Comments
If I recall correctly, your espClient should be completely destroyed to avoid this issue. Try: In setup():
And in reconnect() Ofcourse reference espClient with '->' everywhere. This might help! |
Hi Jeroen tried it but it doesnt work pls see the code below... if you try it, you will see that every time you disable MOBILE DATA and the you enable DATA again, it burns 1KB of heap Any other idea? #include <ESP8266WiFi.h> #define USESSL const char* ssid = ""; const char* mqttServer = ""; #ifdef USESSL const char* ClientID = "ESP8266TEST"; PubSubClient client; String GetStatus() void setup_wifi() {
} void reconnect() {
#ifdef USESSL
} void setup() {
} int loopcount = 0; void loop() {
} |
Try to mimic this example. This creates the WiFiClientSecure when it is needed. It does call connect() repeatedly but instead tests for begin() to return true. The while (!client.connected()) loop still might cause the problem. I have no further ideas :/ |
The handling of the WiFiClient is done within the pubsubclient code. We can't review or reverse engineer pubsubclient to figure out if they're doing something wrong, or if there really is an issue in our core. We just don't have the manpower, which is why we don't accept issues from 3rd party libs. |
Edodad: |
@fsommer1968 suggestion might well work if disconnect() cleans up the client! |
Hi
ESP8266
Arduino Core 2.5.2
PubSubClient 2.7.0
Every time pubSubClient.connect() is called, WiFIClientSecure burns ~1KB of heap, every time, without releasing the OLD memoty
see also related issue
#4497
Every time ESP looses internet connection, pubSubClient.connect() is called and then it burns ~1KB of heap, every time, without releasing the OLD memoty
I tested it using Smartphone HotSpot, disabling the MOBILE DTATA (just MOBILE DATA) the re-enabling
Here below some code that reproduces the issue
The text was updated successfully, but these errors were encountered: