In the Xbee 3 Zigbee RF Module User Guide it is stated that one of the limitations of the file system (compared to conventional file systems) is the following:
“When a file on the file system is deleted, the space it was using is only reclaimed if it is found at the end of the file system. Deleted data that is contiguous with the last placed deleted file is also reclaimed.”
Could someone please explain what does it mean (for a file) to be at the end of the file system? Especially, in a practical level…How can I make sure that I delete the files at the end of the file system - and actually free some space?
Thanks in advance!
Thank you for your reply.
The suggested reading regards the RAM (heap) memory. My question though was focused on issues regarding the flash memory.
Unless I have misunderstood something. In that case, I would appreciate any further assistance.
Thank you again
I think you have. This pertains to the file system and its memory and how it is accessed and how to keep from having the issue you mentioned.
Well it’s been a while, but still I wasn’t able to solve my problem…
Despite deleting a file from my flash (using uos.remove), I cannot free space from the flash (although the file is not listed anymore in uos.listdir, it still occupies flash memory, which I can only free by formating the flash). And both gc and micropython module have not helped somehow…
Obviously, I am missing something…
So, please any help is welcomed!
I am not aware of any other way of doing it.
As mentioned in an other topic, I managed to delete file(s) from flash, by following those steps (in case somebody faces the same problem):
- Update the firmware…It seems like uos.remove method was not working properly in some older version of the firmware or something…
- List files with the respectful method
(meaning that you have to import uos and then call uos.listdir())
- The last file showed by listdir is the one to be firslty removed (uos.remove(“filename.py”)
In case you want to delete more files, you have to do it sequentially. If you want to only delete the (i.e) second to last file, then you can NOT apply the uos.remove method, because doing so seems to work but in reality the file still occupies the same size in the flash memory. Only, solution is to delete all files until the one you wanted in the first place!
Thanks for your help