09-14-2018 09:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-14-2018 09:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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...?

- Labels:
-
JavaScript
09-14-2018 09:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


09-14-2018 09:43
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

09-14-2018 10:49
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


09-14-2018 13:58
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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.
Gondwana Software
