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

Storage: Can end up with duplicate files #1801

Closed
gfwilliams opened this issue Apr 16, 2020 · 1 comment
Closed

Storage: Can end up with duplicate files #1801

gfwilliams opened this issue Apr 16, 2020 · 1 comment

Comments

@gfwilliams
Copy link
Member

On page size: 4k

s=require("Storage");
s.eraseAll();
s.write("a",new Uint8Array(4000));
s.write("b",new Uint8Array(100));
s.write("b",new Uint8Array(10));
s.list()

Noticed at:

http://forum.espruino.com/conversations/344259/?offset=25#15211494
http://forum.espruino.com/conversations/345948

@gfwilliams
Copy link
Member Author

So what actually happens is the flash memory is paged. Espruino tries to write stuff so it's not straddling page boundaries if it thinks it can. If you write something big and then something small (or the flash area changes) it can find a free area to write into before it finds the old file to erase.

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

No branches or pull requests

1 participant