-
My first thought was that bangle was keeping files read from strorage (which I do in "loadRoute") in memory
Storage.read
returns just pointer to flash. However RAM is used once you start manipulating the data (like reading short blocks from storage and concatenating them) so sometimes it may be better to 'read' whole file at once and just iterating over the big string or array than reading in small chunks and possibly joining them back. so depends on your loadRoute code whether it ' was keeping files read from storage in memory' . If it was just iterating over it there is no data to garbage collect.Also the interpreter is running code directly from flash not using RAM. Unless you upload code to RAM, then it of course needs more RAM for storing uploaded code.
-
loadRoute is doing two things. Its reading the gpx file with Storage.read, and parsing additional json files with jsonRead. In both cases I am parsing the data into local constructs. The mem used by both these functions is correctly releasing the memory once outside the scope.
I actually think the memory which is released is memory bangle is using when loading up the main js file on app load.
My first thought was that bangle was keeping files read from strorage (which I do in "loadRoute") in memory and the garbage collection for this is somehow delayed. However I checked and this memory is released as soon as the scope ends.