Skip to content

Memory leak 60 bytes at a time #4701

@AbitEncrypted

Description

@AbitEncrypted

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)

Metadata

Metadata

Assignees

No one assigned

    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