-
Notifications
You must be signed in to change notification settings - Fork 20
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
SQL out of memory error after 5 insert #22
Comments
Hi, please see this reply, but the example is for esp32 library: |
Hi Arun, I am trying to use your library to log some data that is being gathered by the ESP32 PCNT and then processed(min,max,avg type thing) before logging. From what you said above on Jun26, is this library not appropriate for inserting data? Can you explain the mechanics behind why it is ony after a period of working that it goes out of memory? I (probably foolishly) would have thought that the memory requirement would be the same for each statement and then would be released once it was written to the db file. Thank you for any time you can spare commenting. FYI:
Of course, params are passed in and the insert query is generated but it is split across two different files so not terribly easy to share. Cheers, |
Hi, Although SQLite is light for desktops, its not so light for ESP32/ESP8266. The SQLite source heavily uses dynamic memory allocation and I could not say much why you are facing issues unless some sample code can be shared. However in general, using prepared statement as in this example should help: https://github.com/siara-cc/esp32_arduino_sqlite3_lib/blob/0850945aa8f20504d4dc3ad3e9a7c36939e51fbc/examples/sqlite3_bulk_data_insert/sqlite3_bulk_data_insert.ino#L164 There is also a lot about when memory is released and fragmentation over time: |
Hi, I've read all the various posts on the "out of memory" error but I detect inconsistent behavior.... I write a small record on the SD every 30 sec and sometimes it goes into error, sometimes not, always with a good heap, you see. INSERT INTO ele_log(V,A,P,cosFi)VALUES(1,1,1,0); INSERT INTO ele_log(V,A,P,cosFi)VALUES(1,1,1,0); In any case even when there is an error, the record is written... any ideas? |
Hi,
I am using your library in ESP8266 12 E board. As you suggested, I have changed the stacksize to 6144, Page size of db is 512.
It worked fine initially and after 10 insert statements, I am getting error SQL out of memory.
Do you have any idea to fix this ?
On checking free heap, it is 27672 before executing insert statement. AFter it get SQL out of memory error, free heap is 31304.
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: