Getting Memory allocation Errors #145
-
Hi there! Hope you must be great... I am using this library for a long time since now, but recently I started facing some errors of Memory Allocation Failed and guru meditation error: core 1 panic'ed (loadprohibited). exception was unhandled. These errors cause Connection Lost problem and After some time my ESP32-WROOM-32 has to Reboot. I face these errors after some random time. And sometimes these errors never come for Some Hours... Can you please help me in getting through that problem? I am using RTDB and Firestore currently.... |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
You should debug by checking free heap and print via serial. Device will not crash because of memory allocation unless you continue to use the object or variable that failed to allocate the memory. In case of memory leak, you need to check your dynamic memory allocation and deallocation, don't forget to free or release it. You should create the function for group of codes and check the free heap before enter and after exit the function. |
Beta Was this translation helpful? Give feedback.
-
From the test with stream callback example. The free heap before Firebase and WiFi set up is about 274k. This is the memory management problem in your code. You should reduce the memory usage (reservation) by define the variable as local instead of global to free up memory after exit that usage scope.
This can't tell everything as the Serial was initiated at the beginning already with Serial.begin. I can't help anything in this kind of question that related to user code and his implementation. |
Beta Was this translation helpful? Give feedback.
From the test with stream callback example.
The free heap before Firebase and WiFi set up is about 274k.
The free heap after Firebase and WiFi setup is about 252k.
The free heap after two FirebaseData objects opened the session (server connected and kept session to open) is about 173k.
And after the two sessions closed, the free heap turns back to 260k.
This is the memory management problem in your code.
You should reduce the memory usage (reservation) by define the variable as local instead of global to free up memory after exit that usage scope.
This can't tell everything as the Serial was initiated at the beginning alre…