09-14-2018 09:15
09-14-2018 09:15
Hi, i am building a clock face which can input data each hour and this data will be stored in a JSON file in device. So when i tried to log the data for some time after some input the clock face crashes showing this error Fatal Jerryscript Error: ERR_OUT_OF_MEMORY. Each time i log the data i am reading the file and re-writing the updated content to the file back. Can any one please explain why this happens and how we can solve this...?
09-14-2018 09:43
09-14-2018 09:43
Rather than reading and writing the file each time, why not just open it for appending? https://dev.fitbit.com/build/reference/device-api/fs/#opensync-
09-14-2018 10:49
09-14-2018 10:49
is there any other method for appending data to the file? or i have to open the file in append mode and write data into it? The data i need to write into the file is a JSON array.
09-14-2018 13:58
09-14-2018 13:58
To (hopefully) avoid memory problems, I'm using binary files to keep data. Binary data is much more compact than JSON, and the API allows you to write to write new data to any location in the file. It does mean that you basically have to roll your own flat-file database, but it does work and is very quick to run.