Running low on memory

Posted on
  • Hi everyone,
    I've had my Bangle.js for a while and I'm quite happy with it. I just absolutely love the philosophy behind it.
    However, I have recently began to have some issues with it.
    The thing is using most watch-faces I frequently run into the dreaded "low-memory" red letters in the bottom of the screen, that just freeze the interface until I reset the watch.
    I am currently using the "Kitchen combo" watchface, and I don't have enough memory for all the features (changing watch face after "E-CALIB" with BTN3 will result in the interface freezing with the "MEMORY" red letters below). Consulting the memory usage using the same watchface shows 88-90% memory in use.
    I don't have that many apps installed (17 total), 3 of which are widgets (Active pedometer, Gagdetbridge, and battery level widget). I also have the "Notifications" app installed, which might count as a widget too.
    Firmware is 2v09 commit(7247a2c4) according to "About" which I installed for the purpose. All other apps are up-to-date as of today's Bangle.js app loader.
    I have already tried to uninstall and reinstall all apps, but it doesn't seem to make any difference.

    My question is - is this normal behavior? Or is there something odd going on with my Bangle.js? What other steps can I take to further debug the issue (if it is indeed an issue!)

    Thank you in advance!

  • Did you update anything in the last weeks? I did an update on firmware and apps and since then I have also a memory problem. There is also another thread on this.

  • I have only started using Kitchen Combo today (the day I started this thread), after all the updates. But I did start to experience this sort of low memory issue when I updated to bootloader to v0.23 (but I'm not sure what version I was on before). Is there a way to 'downgrade' to a previous version for testing?

  • I think it's possible that Kitchen Combo is pushing the limits of free memory. I wonder if @HughB (the developer) has the Gadgetbridge widget as I guess he may have designed Kitchen Combo to run without it.

    Active pedometer will use a little more memory than the normal pedometer too, but nothing you have installed there should really use loads of memory. The Notification library shouldn't use any RAM until you get notifications in either.

  • @Gordon Low memory seems to be related to firmware, bootloader or launcher. I changed nothing for months and after updating the mentioned software parts the watch has memory problems up to complete reboot.

  • I think it's possible that Kitchen Combo is pushing the limits of free memory. I wonder if @HughB (the developer) has the Gadgetbridge widget as I guess he may have designed Kitchen Combo to run without it.

    Ok, so maybe we can work together with @HughB to try and optimize memory usage? For instance, "Multi Clock" which has a very similar font to "Kitchen Combo" also used to give me low memory problems. Maybe there is room for optimization there?

    In the meantime, just today something else happened (which might be related to this issues). My Bangle.js stopped receiving notifications from gadgetbridge - not completely stopped, it would vibrate, but no notification message would appear. I tried to reboot the phone by accessing "Settings", but a longpress on BTN2 resulted in the dreaded red "Memory" message in the bottom. So I tried a long BTN3 press, to reset the watch face, but instead of resetting the watch face I just got a black screen. After a few seconds, the red "Low Memory" message appeared again. Since the Bangle.js was completely unresponsive, I did the longpress on BTN1+BTN2 to reboot it, which it did. But something went wrong, and now the watch is stuck on the "splash" screen (attached).
    Rebooting it using the same method, doesn't seem to help.
    While the Bangle.js is stuck in this screen, is there anything I can do to debug?
    I suppose reinstalling all apps should solve the issue, but maybe we can learn something else from this state?


    1 Attachment

    • photo_2021-07-21_18-25-50.jpg
  • Ok, so this seems to be the issue reported here by @Sander. I will continue discussing this issue there.

  • I just can repeat myself: I face the same issue here and without @HughB s "Kitchen Combo". @Gordon The memory issue seems to be related either to firmware, bootloader, launcher, battery widget, notification or gadgetbridge.

  • Ok, thanks! If you haven't done anything yet, please can you run require("Storage").list() via the IDE to see what files are still on the device?

  • Sorry - I just saw your post on­365414/ - that'd super helpful, thanks!

  • So somehow, the Storage has got very corrupted. Have you now completely reset your Bangle, or could I give you some code to run on it to dump the raw data so I can try and debug it?

    It seems you're on 2v09, so the storage issues I was aware of have been fixed. I guess you were using active pedometer at the time so that would have been logging data. If there's any hints you can give me on how to reproduce this myself I'd really like to hear them though - if I could find a reliable way to break storage it'd be perfect, then I could debug it.

  • The recipe to replicate it is install the stack of Kitchen Combo, Pedometer, Gadgetbridge and (maybe) Fullscreen Notifications.
    It will work OK initially then you start getting memory errors when cycling the clock and I think the pedometer (like you mentioned) somehow overwrites something in the configuration. Usually within a day or two the face goes blank and rebooting shows the error listed above.

  • Ok - and it's specifically the active pedometer, and firmware 2v09? I can try them on a watch here, leave it, and see what happens

  • Unfortunately I can't seem to find a way to reliably reproduce the issue. But indeed, the one time it did happen, it was as @Sander mentioned. The memory errors were triggered, and boom - storage was broken. Unfortunately, I have reset the apps on the Bangle.js and cannot run any further debug code.
    But if you leave your suggestions here I can run them on the IDE next time this eventually happens. Unless the files I left on the other thread were sufficient.

  • Thanks! If you turn on logging in the IDE (settings -> general -> terminal log icon, then click the new icon) then paste the following code:

    (function() {
      var addr = 0x60000000;
      var len = 1024*1024*4;
      var f = require("Flash");
      function log() {
        var l = 32, d =,addr).slice();
        if (!d.every(x=>x==255)) print(
>x.toString(16).padStart(2,0)).j­oin(" ")
        addr += l;
        len -= l;
        if (len>0) setTimeout(log, 2);
        else print("Finished!");

    it'll dump out the full contents of flash memory (it'll take a while!) and I could then copy that data onto my device and try and figure out what went wrong. Although it's not guaranteed I'll be able to find the issue from that - finding a way to reproduce it reliably and quickly is much more likely to lead to a fix

  • Ok! If the issue ever crops up again I'll be sure to run that in the IDE and post the contents here.
    Thank you for all the help and responsiveness!

  • My watch was in that condition, but I couldn't connect to it using the web IDE. When I tried to connect it gave me an error. I was able to reset it though.

    Is there an easy way to simulate the pedometer movement? The problem seems to happen when I'm out so I'm guessing it might be something which is updating gadgetbridge/pedometer.

  • Is there an easy way to simulate the pedometer movement?

    You can just move the bangle up and down at a regular rate...

    Or, you can just do something like this in code:

    var n = 1;
    setInterval(function() {
      Bangle.emit("step", n++);
    }, 1000);
  • Hi there. HughB here. So @Gordon is right I am not using GadgetBridge. In Kitchen Combo I am pushing the limits of memory as far as they will go to squeeze in the functionality that I wanted to put together. My setup runs at about 82% of RAM usage most of the time. I did run into LOW_MEMORY issues a lot when I was using buffered writing to the display. I since rewrote the code and accepted screens that have a small amount of flicker. The thing with multiclock , it is only doing clock type functions which are not very complex, fairly simple logic. In Kicthen combo the GPS face shares an object with the WayPointer face so that there is a seamless switch between the GPS data, ie no waiting for a fix etc. Each face can call gpsObject.getFix() and do what it needs with it. Recent changes in the way the firmware works might make that redundant now. But basically there is no central control of the GPS functionality. You can't poll the GPS using something like Bange.getGPSfix(), you have to setup a listenner for every app etc. One of the ways of reducing the footprint of Kitchen combo would be to delete the watch faces you dont want to use, that will give a small amount of RAM back but most of the memory is taken up by the common code in I have also produced single App versions of the watch faces in Kitchen Combo, look for Apps of the same name that are quoted in the README file.

  • most of the memory is taken up by the common code in

    The strange thing is, normally all the code itself should stay in flash memory, and it's just the function definition that takes one or two variables. I wonder why so much memory is getting eaten up?

  • Ahh ok, I just took at look at the code. Even though the function code is in Flash I guess there are just so many functions in there it's using all the memory.

    Can I suggest that you just remove functions like:

    TRIP.prototype.getTripState = function() {
      return this.showTrip;
    TRIP.prototype.setTripState = function(t) {
      this.showTrip = t;

    And just access showTrip directly? Literally all the getters and setters are doing here is using up memory and slowing things down.

    The other option you have is to do something like:

    GPS.prototype.getUtils = function() {
    return {
      getWPdistance : function() {...},

    This way, the functions aren't loaded into RAM all the time. You just call gps.getUtils().getWPdistance() instead, and it's slower, but absolutely everything stayed in flash until it was needed.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Running low on memory

Posted by Avatar for Stunts @Stunts