You are reading a single comment by @AkosLukacs and its replies.
Click here to read the full conversation.
-
Here is an example that creates a 1000 long file, read-s it, and free memory doesn't decrease by a lot (CPU is bare nRF52832, same as in the Bangle)
So you didn't use Bangle when trying this? There may be another issue that Bangle uses external SPI flash for storage (?) which is not directly mapped to cpu address space so data needs to be loaded to ram at some point.
Storage.read docs agree with wath you say: "This function returns a String that points to the actual memory area in read-only memory, so it won't use up RAM."
Most likely what you do next uses all the memory. Here is an example that creates a 1000 long file,
read
-s it, and free memory doesn't decrease by a lot (CPU is bare nRF52832, same as in the Bangle):You can force it to take up memory by slicing into it for example:
On each invocation memory decreases by
86
vars, and the 12 byte of string perjsVar
int the Performance section.86*12 = 1032, there is a bit of overhead for history and storing the actual variable.
You can also try
readArrayBuffer
if you want to work with binary data. That doesn't eat up memory right away either:Oh, and you can get the size of things: