Skip to content
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

sleeplog: Fix LOW_MEMORY,MEMORY error #1835 #1839

Merged
merged 1 commit into from
May 17, 2022

Conversation

storm64
Copy link
Contributor

@storm64 storm64 commented May 17, 2022

Check and if neccessary reduce logsize to 1500 entries in writeLog() to prevent low mem error.

Check and if neccessary reduce logsize to 1500 entries in writeLog() to prevent low mem error.
@gfwilliams
Copy link
Member

Thanks! Just to add that you could use StorageFile (which handles appends) to store one record per line (still as JSON) and that'd mean you could store data much more easily - it'd be way faster and it'd hardly use any memory. The current method is rewriting a whole new file for each entry added too.

You could then 'stream' the data out, line by line, and again there would be no memory limits.

While 1500 would (I think?) work on Bangle.js 2 as long as there isn't much data it'd still kill Bangle.js 1.

@gfwilliams gfwilliams merged commit 215204d into espruino:master May 17, 2022
@storm64
Copy link
Contributor Author

storm64 commented May 17, 2022

The "new" sleeplog is using StorageFiles and only writes old data into a seperate new file.

While 1500 would (I think?) work on Bangle.js 2 as long as there isn't much data it'd still kill Bangle.js 1.

The sleeplog app is not supported on Bangle.js 1 for now because of the excessive memory needed.
I hope the new app might be able to run on lower memory.

@gfwilliams
Copy link
Member

Ahh, great - thanks for letting me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants