-
• #2
Maybe I've found the solution:
require("Storage").compact();
Is it correct?
-
• #3
Sat 2021.03.20
'even if I simply overwrite same piece of code one or more times'
Would you please post your code snippet that demonstrates the write and then read process.
By chance are the modes mixed?4th bullet below heading 'A few things are going on here:'
'A file created with require("Storage").open is different to one created with require("Storage").write since it is designed to be appended to. As such you can only access the files with require("Storage").open and not with require("Storage").write/read/erase/etc'
'even if I simply overwrite same piece of code one or more times'
It would help by posting the results alternating between each of these instructions demonstrating the 'overwrite' as is observed.
-
• #4
Hi @Robin,
first of all thanks for your reply.
I think there is a misunderstanding, maybe I've messed up my explanation.
I've experienced the following using IDE:
- get code of MorphingClock from my Bangle storage using specific icon (4 disks);
- modified code and tried it with success using RAM upload function;
- overwrite existing mclock.app.js code into Bangle storage using specific icon (chip icon with drop down menu);
After each cycle of changes made as exposed in the pointed list above, looking at 'About' app I've seen my free disk space reduced.
For each cycle, space consumption increased of the amount of bytes occupied by code uploaded; like it was written n times in place of one time in the same position.
Yesterday I've discovered 'require('Storage').compact()' function and I've tried it with success.
Now space consumption value is as expected.No new files were created during changes or coding, neither inside the code nor through upload function. I've made changes and then saved them on the same file (mclock.app.js) n times, nothing more.
After this I think this behaviour is normal, but my question is what about to happen if space consumption reading would reach the maximum.
Thanks for patience.
Massimiliano
- get code of MorphingClock from my Bangle storage using specific icon (4 disks);
-
• #5
Yes, it is normal, it will call compact automatically when there is no free space when trying to create file
https://github.com/espruino/Espruino/blob/ea8ba1c2ff9c9bfa1d19f5c5911818e0a43c7f4f/src/jsflash.c#L454 -
• #7
Thanks for explanation.
It solved my doubt.Massimiliano
Hi all,
I've seen that each time I write code onto Storage using IDE free space read by "About" app is reduced.
This happens even if I simply overwrite same piece of code one or more times.
Is it real?
What I can do to avoid it?
Sorry but I'm confused.