Questions about E.openFile #7769
-
Hi there! Currently working on a couple of apps for the TWC Pip-Boy. Since there's quite a tight limit on memory (and therefore on file reads/writes), I've had to move over to stream file IO to avoid memory fragmentation when accessing files. (seemingly related to this issue https://github.com/orgs/espruino/discussions/7114 - looks like it hasn't been fixed) I've been wondering though:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
That filesystem issue should really have been fixed. Can you provide me with some code that causes the problem just to be sure? You do have to close files (afaik) when you're done so if you're not doing that you'd run out of memory. Maybe you could catch the file open error and call So what happens when you try to read a file opened with Under the hood we use a library called
I don't think so, no - not on the same file. |
Beta Was this translation helpful? Give feedback.
That filesystem issue should really have been fixed. Can you provide me with some code that causes the problem just to be sure? You do have to close files (afaik) when you're done so if you're not doing that you'd run out of memory.
Maybe you could catch the file open error and call
E.defrag()
? If that works potentially I could add that inside the firmware.So what happens when you try to read a file opened with
w+
? I'd be a bit concerned that having two copies of the same file opened at once might cause problems (as changes to the writable one may not immediately appear on the readable one).Under the hood we use a library called
FatFS
- it feels like read+write should work. Looking at h…