• I think it might help to slightly extend the contents of the app file after it has been erased then write it back. Otherwise the chances are you might just write it back to the same slot in the storage. This would be a more real world use case.

  • Otherwise the chances are you might just write it back to the same slot in the storage.

    You don't do that. That's why the compact is there. You can't write to same place twice without block erase. So you always write to 'new' erased space. And once you are out of it you start erasing to reclaim dead space and fill it again with valid data next to each other. then you end with one free erased area and continue until it is filled again. Or did I miss your point? Could be.

    What I mean is that https://www.espruino.com/Reference#l_Sto­rage_erase just marks dead space which is unusable until you do compact()

About

Avatar for HughB @HughB started