Skip to content

Memory leak 60 bytes at a time #4701

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

Closed
1 of 3 tasks
AbitEncrypted opened this issue Apr 30, 2018 · 2 comments
Closed
1 of 3 tasks

Memory leak 60 bytes at a time #4701

AbitEncrypted opened this issue Apr 30, 2018 · 2 comments

Comments

@AbitEncrypted
Copy link

AbitEncrypted commented Apr 30, 2018

memory leak

Basic Infos

  • [x ] This issue complies with the issue POLICY doc.
  • [x ] I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • [x ] I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware: Wemos D1 Mini
  • Core Version: [latest git hash or date]
  • Development Env: [Arduino IDE & Visual Studio for Arduino]
  • Operating System: [Windows]

Settings in IDE

  • Module: [Wemos D1 mini r2]
  • Flash Mode: [?]
  • Flash Size: [4MB/1MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method: []
  • Flash Frequency: [40Mhz]
  • CPU Frequency: [80Mhz]
  • Upload Using: [SERIAL]
  • Upload Speed: [115200] (serial upload only)

Problem Description

A small memory leak of ~60bytes occurs after making a call to UniversalTelegramBot::getUpdates()
See attached graph.
This coincides with the following Serial output when the bot debug is set to true.
See debug messages below.
Once the leak takes memory to 4k the Wemos resets. See debug messages below.
I am using board manager ESP8266 v2.4.1. I was using v2.3.0 prior to the latest because the memory leak was even worse.
My sketch which is controlling a Worcester-Bosch Boiler has been working flawlessly until I decided to add a web client to control the boiler,i.e., #include <ESP8266WebServer.h>. There is no memory leak when the UniversalTelegramBot is disabled. I'm posting the issue here because the leak occurs after the bot makes a call to WiFiClient::Connect().

MCVE Sketch

My sketch is too large to go here.

Debug Messages

Checking for bot messages
GET Update Messages
[BOT]Connecting to server
.... connected to server
{"ok":true,"result":[]}
incoming message length23
Creating DynamicJsonBuffer
no new messages

Eventually the memory falls to 4k and the Wemos throws -
[BOT]Connecting to server

Exception (29):
epc1=0x4021f9fa epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000004 depc=0x00000000

ctx: cont
sp: 3fff2070 end: 3fff28f0 offset: 01a0

stack>>>
3fff2210: 00820000 00000082 3fff7b5c 4022cd12
.......
<<<stack<<<

ets Jan 8 2013,rst cause:2, boot mode:(1,6)

@5chufti
Copy link
Contributor

5chufti commented May 1, 2018

probably related to #1923 et al.
there seem to be several ways to "exploit" the wifi.client() memory leak with more or less "leakage".
So I doubt your "[x ] I have searched the issue tracker for a similar issue."

@AbitEncrypted
Copy link
Author

devyte Merge branch 'master' into bugfix/wificlient_connect_leak
Has fixed my issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants