out of memory

Hello together,

Is it possible that I can recognize somewhere, how much memory my watchface occupies? With the simulator I see under File / view memory that memory is occupied with what. I do not see how much memory has my device and how much is still free?

I have the problem that I'm with my Watch face at the 735xt and the Fenix5 at the limit (out of memory). I do not know where I can save space :(
It's really crazy - extra 1300 characters of code that "is currently not being used (!)" more - out of memory, without these lines it works.
  • You can either log it or show it on screen directly using following three System.Stats methods:

    System.getSystemStats().usedMemory
    System.getSystemStats().freeMemory
    System.getSystemStats().totalMemory
  • When you run in the sim, the bottom line of the window tells you memory usage.

    Mem: xx.x/yykB peak:zz.zkB

    xx.x is what you use when idle, yy is the max allowed on the device you have as a target, and zz.z is the most you've used when running.

    With the f5 and 735 and a watchface you have a max of 58kb, while you have 64kb on a 23x or f3, so you might be able to see how close you get. If it runs fine on those and is 59kb peak, that will give you an idea how close you are.

    As far as saving memory, it's hard to say without seeing your code. For example, if you are using a bunch of bitmaps all loaded at the same time that could do it, or it could be what variables you use and how you use them, etc. (a single large array could be the issue, or how many colors in a single bitmap)
  • Oh man, it's that simple ... thank you. The footer of the simulator I have not noticed so far.
    I use so far no bitmaps but different fonts. I have to work again and delete unused characters ....

    (my code is open source and linked to github :) )
  • Custom fonts and burn up a lot of space if they are large. And if you are using them to display the time, you can easily cut back to something like 0 to 9 and ":", and not include any letters.
  • Hi,
    maybe also have a look in this thread.

    https://forums.garmin.com/showthread.php?360789-Fenix-Chrono-compatibility-problem


    "If you are building an app that you developed on Fenix 3 for Fenix Chronos, you will want to check any bitmaps you are using in the app. The Chronos supports more colors, so bitmaps that do not specify a color palette will double in size when built for Chronos. If this is your issue, you can specify the Fenix 3 color palette for your bitmaps, and they will return to the original size."