Report Bugs Here

Moderator: Mmiscool

User avatar
By psc-esp8266
#45331 I must apologise! Wget does not have a memory leak.

After painfully trying to find work-aronds I found more and more examples that caused a reboot. I almost gave up on the basic interpreter when I found the cause of all memory leaks/instabilities.
And it's actually quite understandable:

As documented, every print (or wprint) sends output to your http "console" (where you edit your programm and view your programms output).
As documenend these data is kept until a "wait" command is executed.
But that is not the whole story.
Unless you do a refresh on your browser (F5) that stalled data is not requested for and therfore will not be sent.
But it *is* kept. Kept until there is no more space in RAM! And THAT causes the reboot.

Solution:
- send all unattended (log) data to your serial console with "serialprint"
- don't send *any* dynamic data to you http session. It is not a console, it's a web page!
- or start with a wprint "<meta http-equiv='refresh' content='10;URL=/input?'>"
- or keep regulary pressing F5 yourself

Other reported and unexpected crashes migth have a silmilar cause. It might be worth retesting them! :idea:
User avatar
By cicciocb
#45338 Yes what you say is correct.
In fact there were a memory leak problem in the past versions; this has been fixed since a lot of time.
The problem you faced is more a memory saturation and should be avoided as you suggested.
The memory available for esp basic is around 20 Kbytes but as soon as it drops below ~10 Kb, the esp become unstable and crashes very often; this is because the ram is shared with the normal activity of the ESP framework (network, serial port, ...).
So, the golden rule is : use freeram() as much as possible to check your free memory