Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

clock face crashes showing OUT_OF_MEMORY error

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...?

Best Answer
0 Votes
3 REPLIES 3

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-

Best Answer
0 Votes

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.

 

Best Answer
0 Votes

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.

Peter McLennan
Gondwana Software
Best Answer