Skip to content
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

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

Open
tackelua opened this issue Mar 3, 2017 · 5 comments
Open
Milestone

Comments

@tackelua
Copy link

tackelua commented Mar 3, 2017

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?

@tackelua
Copy link
Author

tackelua commented Mar 4, 2017

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

@tackelua tackelua 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() Mar 7, 2017
@proppy
Copy link
Collaborator

proppy commented Apr 10, 2017

Seems similar to #252

@proppy
Copy link
Collaborator

proppy commented Jun 15, 2018

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

@yhua537
Copy link

yhua537 commented Aug 28, 2018

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
Copy link

yhua537 commented Jan 24, 2019

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
Projects
None yet
Development

No branches or pull requests

3 participants