Changes to Datafield Memory Limit

Former Member
Former Member
Back during v0.2.0, I made a datafield that displayed the T-Score in using only heart rate, through a rather complicated algorithm. I left it sitting while waiting for the app store, but now it refuses to run in the simulator due to a lack of memory. Is there a way to increase the amount of memory available?

Thanks.
  • Unfortunately, no. Since this is running in a virtual machine embedded on a device, there are strict memory limits allotted to apps.
  • I have a bitmap 218x150px 16 colors with size 600 bytes.
    Without loading resources simulator says the DataField uses 9KB out of 16KB available.
    When I try to use Ui.loadResource compilator says Out Of Memory Error

    Does it mean 7kB is not enough to load 600b bitmap?
  • I had a bit of a problem with this myself.

    The 920XT simulator default is to load with 16 colors. The VivoActive simulator default is 64 colors so uses even more memory.

    If you are not using all 16 colors, you can force it to load with fewer colors and save memory by specifying a palette. This is how I made my resource file to force bitmaps to load with 2 colors since they were black and white anyway. More info in the Programmers Guide on page 34 (SDK 1.0.0).

    <resources>
    <bitmaps>
    <bitmap id="LauncherIcon" filename="images/icon.png" >
    <palette>
    <color>FFFFFF</color>
    <color>000000</color>
    </palette>
    </bitmap>
    <bitmap id="id_mo2" filename="images/mo2.png">
    <palette>
    <color>FFFFFF</color>
    <color>000000</color>
    </palette>
    </bitmap>
    <bitmap id="id_hr" filename="images/hr.png">
    <palette>
    <color>FFFFFF</color>
    <color>000000</color>
    </palette>
    </bitmap>
    <bitmap id="id_cad" filename="images/cad.png">
    <palette>
    <color>FFFFFF</color>
    <color>000000</color>
    </palette>
    </bitmap>
    <bitmap id="id_pwr" filename="images/pwr.png">
    <palette>
    <color>FFFFFF</color>
    <color>000000</color>
    </palette>
    </bitmap>
    </bitmaps>
    </resources>


    I'm not sure exactly how bitmaps are handled, but here's some quick math if there's no compression.

    150 X 218 = 32700 pixels
    16 colors takes 4 bits so half a byte
    That makes right at 16kB for a 16 color bitmap

    By this math, you'd need to limit to 4 colors to get under the 7kB limit.

    I'm not an expert at this so someone please correct me if I got this messed up.
  • Former Member
    Former Member
    You pretty much nailed it Roger.

    4 colors might not be quite small enough as it would still be at about 8kB. If the (I'm assuming) JPG you are using as a source is only 600B, then maybe it is already a 2 color image. Limiting the image to black/white (or any other 2 colors) like Roger's example would get it down to about 4KB.
  • Thanks for good direction.
    That's sould be enough for now:)
    I want to use mountain running race elevation profile and visualize my position on it. This was already technically possible on fenix2.
    Now is much better but still looks like not possible!(that's insane with all this technical possiblities)
    I know I can make an app but...an app is an activity so my activity will have only elevation profile? No pace, speed, distance...

    All those complex apps in the future(not datafields) are super cool but they lack native activities code. So each developer has to code his own avg pace, speed, time elapsed, ascent etc.
    To skip that problem now I just use DataField and put my elevation profile on it(Out of Mem!)

    My Request is: Allow new apps to extend native activity Classes(apps?), so it would be:
    MyAppClass extends GarminTrailRunActivity {}
    Then I make an app and programm one screen DataField with my elevation, have more memory etc. Maybe limit my app to use only some of the native screens(save mem).
  • Former Member
    Former Member
    Is there a particular reason the amount of memory available has been cut down so much?
  • Is there a particular reason the amount of memory available has been cut down so much?


    I guess there is very important reason - not much memory:)
    The question is how we can allow users using more datafields or one/two big ones(memory hungry) and still using base functions and native datafileds.
    Maybe limiting native DF somehow. But thats tricky to let user turning on/off basic functions. There gonna be a mess ;)