Arduino Core 2.4.1 memory leak?

Dear friends,
for those that use the latest ESP8266 Arduino Core, possible there is a big memory leak ( that I suffered also )… Please see:

Thanks and Best Regards,
Mike Kranidis


i can confirm this. using 2.4.0 core i had several hard crashes with several esp8266 units (even the wdt couldn’t restart the mcu, it remains freezed until a power cycle).

i’ve downgraded to 2.4.0-rc2 in the last week, so far that works atom stable for me.

A BAD message it is… :thinking:

Just stick to 2.4.0rc2 until confirmed stable release, it’s working properly.

1 Like

I would go with the latest release of 2.4.1.
It’s still early days but doesn’t seem to be many bugs reported compared with all the previous versions.
As per the link above, memory leak was fixed by a line of code in the sketch for one user and most Blynkers will not be using the memory leak functions.

1 Like

Hello @Costas Paul.
Do you believe that putting a delay(1000) ( 1 second delay for nothing ) before client.stop() is an accepted solution? Or there is other more sane solution?

Actually I have no idea because most of my Blynk projects don’t use client.stop() and I believe that goes for the wider ESP8266 community. If I was using client.stop() I would start by testing how small the delay() could be to prevent the memory leak.

The ESP8266 community as a whole doesn’t appear to have an issue with memory leaks.

Have you encountered leaks with any regular Blynk sketches, and if you have can you provide a minimal sketch that demonstrates the problem.

My memory is always leaky :confounded:… but so far my projects are working just fine on 2.4.1

Dear @Gunner, as far as I have seen in my case at least, the problem is related to external sites like ThingSpeak. In my project I have a virtual switch in the Blynk that activate or de-activete the ThingSpaek sending data. With this active, the memory leakage is just awful in contrary with this de-activated the memory leakage is gone…
If you have time and want to test, do the same and make a timer printing for the free.heap and let us know the result.
Something like:

terminal.printf("ESP free heap=%d, time:%02d:%02d:%02d\n", ESP.getFreeHeap(), hour(), minute(), second() );

Best Regards,
Mike Kranidis

I will try to see what will happens if I remove the client.stop() … Testing the delay, did not improve something in my case…

My humor sometimes gets me involved where I have no business being :stuck_out_tongue: I do not use any API, webhooks, external links, etc., so honestly I wouldn’t have a clue. The only available project I could dump that into right now is running on a Arduino Mega, so not relevant hardware, sorry.

1 Like

Are you using the Blynk Webhook or your own code for this? I suspect the latter and would be interested to see if there are any issues when using the recommended Webhook.

Do you have a few lines of code that I could test in the Webhook with my Thingspeak account?

you guess right, I am accessing the ThingSpeak using my own code that till now, I mean the pre 2.4.0 ,era was working fine…
With ThingSpeak routine on:

With ThingSpeak routine off:

Is it not possible with the Webhook?
We do our Thingspeak and other 3rd party updates via the Webhook.

I really don’t know…
Actually, the best solution is to have my code running as perfect as before and not to searching for workaround… Let’s see what the masters of ESP8266 Arduino Core will do!

The issue doesn’t appear to have been picked up by the Core gurus yet.
You might want to add a basic sketch to the issue that demonstrates the problem and it might push things along a little.

I agreed, I need a little spare / free time to do that. I will try.

@mikekgr an update to the issue, for one user local client declaration, rather than global, was the fix.

1 Like

@Costas Unfortunately Paul, I did the suggested changes but, in my case, the exactly the same behavior exposed. So, I have to wait for the proper solution. Thanks for the helping hand.

@mikekgr you have probably seen that top, Core developer Ivan is expecting to push a fix later today. It will then require either:

  1. Hack the libraries as per the PR until the next official release.
  2. Stay with the minor fixes you already have until next release.
  3. Pick up the master from GitHub.