-
• #2
I wouldn't worry about MEMORY_BUSY, it's just a warning and is unlikely to affect the code.
I think what's been hit is something I noticed with the slopeclock as well.
Basically when you have a custom font, you've got the code in something like
setFontLatoSmall
which doesthis.setFontCustom(E.toString(require('heatshrink').decompress(atob('...
The issue is that
E.toString
is used here to create a string from the array, but it has a second effect - it tries to force what is has into a 'flat string' and if it can't it returns 0. Over time the memory can get fragmented and then sometimes it gets so fragmented there's no way to allocate a contiguous memory area of the length needed, and 'E.toString' returns undefined and this breaks.It's a tricky one to fix nicely, since I can't change
E.toString
to add an option like{forceFlat:false}
as it's supposed to use all it arguments. I could addE.asString
or something like that and then we change all the font code tothis.setFontCustom((E.asString||E.toString)(require('heatshrink').decompress(atob('...
?I guess the nice solution would be to rename
E.toString
toE.toFlatString
, and to makeE.toString
just use a string if a flat one can't be allocated - but that would make anyone's code that uses Inline C/assembly unstable unless they changed it.The way to work around it in your clock is to pre-allocate the font bitmap as was done here: https://github.com/espruino/BangleApps/commit/c47bc078acf593e3e7554c557c1fa01fd68fc14a
The side-effect is your clock actually works a bit faster too, at the expense of more RAM usage.
I have been trying to catch a hang bug I see very rarely with my Lato clock.
I suspect that the problem is not down to Lato as the clock will run for days without issue
I was trying the mitherm app yesterday and that went offpiste and I had to reset the watch - so it might be associated with that. Prior to installling that app everything had been fine for 10 days or so. Theat could just be clutching at straws as I dont have a reproducable test case for this problem yet - its very random and rare.
Last night I woke up at 5Am and noticed the clock said it was 2:37am - ie the hang had occurred.
This morning I managed to retrieve the log.txt file and can see the following.
The question is, what caused the MEMORY_BUSY ? and did that corrupt the app code ?