Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
This repository was archived by the owner on Mar 17, 2025. It is now read-only.

How to release memories in loop() if I use Firebase only in setup() #251

Open
@tackelua

Description

@tackelua

Example, I have a program with below struct:

void setup()
{
    checkFree(); //#check 1
    Firebase.getString(.....);
    Firebase.push(.....);
    Firebase.push(.....);
    checkFree(); //#check 2
}
void loop()
{
    checkFree(); //#check 3
   //Do something but do not use Firebase continue
}

When I check free memory by function ESP.getFreeHeap():
#check 1: Free 34504
#check 2: Free 15816
#check 3: Free 16040

It's waste memory in loop().
How to delete Firebase or release memories?

Activity

tackelua

tackelua commented on Mar 4, 2017

@tackelua
Author

Have someone help me? 🥇
If I don't use libraries, do Firebase have http api to send data to database?

changed the title [-]How to release memory in loop() if I use Firebase only in setup()[/-] [+]How to release memories in loop() if I use Firebase only in setup()[/+] on Mar 7, 2017
proppy

proppy commented on Apr 10, 2017

@proppy
Contributor

Seems similar to #252

proppy

proppy commented on Jun 15, 2018

@proppy
Contributor

Sorry for the late follow-up: I wonder if this was fixed with esp8266/Arduino@bf5a0f2 ?

added this to the 0.2 milestone on Jun 25, 2018
yhua537

yhua537 commented on Aug 28, 2018

@yhua537

Using SDK2.4.2 and checking the free heap on each all, the memory come down to a stable value, however, is it possible to free it completely as requested by @tackelua ? it is actually related to #28 which merged from #375.

I was also attempt to end the connection by calling end() but doesn't seem to have any impact, any idea how to do it?

yhua537

yhua537 commented on Jan 24, 2019

@yhua537

Just found a working workaround, which i don't really like: add a new function to end the connection by setting the httpclient with timeout to 1 and do a empty sendrequest which will force the connection to fail, it will release the heap, this solution. However, only works with Arduino 2.4.2. Try that on 2.5.0, it doesn't work.

There is some setting in the library stopping the httpclient to free the resource. As i try a normal httpclient request, when it finished, I will free the heap. @proppy , do you know what it is let httpclient hold on to the connection/heap?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @proppy@yhua537@tackelua

        Issue actions

          How to release memories in loop() if I use Firebase only in setup() · Issue #251 · FirebaseExtended/firebase-arduino