Is there (still) a problem with the menu button?

I run my app on the device and it crashes out of memory,
https://youtu.be/SgU2MzJa7Bo
On the sim, it runs forever with a Peak Memory of 109KB.
https://youtu.be/lnfaWpR6AzA

Check the attached videos (excuse the quality!)

I know there was a bug fix to get the menu button to interact with the watch app, but I suspect there's still a problem.

Any suggestions?




  • I'm not sure how the Menu Button would be involved and I'm not sure what the bug fix you mentioned is for, but have you tried logging Peak Memory on the device itself, say every minute, to see what's happening there? It could be the data you're using in the sim makes the app run differently, memory wise, than what happens on the watch
  • How do you log peak memory?
    Pretty sure it's not data:it always crashed on device, never crashes on sim - only variable is the data (from sim or real from GPS)
  • In your code, you can track usedMemory, but you may have to do it in a few places to see where it peaks. Just logging usedMemory in a timer may let you see what's happening, if that keeps increasing.

    Does the CIQ_LOG tell you where it's crashing? Log usedMemory there.
  • The CIQ.YML does report where it crashes. When I log memory before the line, it reports 120744 on the device and 107816 on the sim. That's a massive 12.9Kb difference.
    The crash line is
    System.println("memory:"+ System.getSystemStats().usedMemory);
    (new Ui.Bitmap({:rezId=>Rez.Drawables.NotNavIcon
    //,:locX=>screenWidth/2-74// 0
    ,:locX=>xOffset
    ,:locY=>yOffset
    })).draw(dc);

    and notNavIcon is a 500 byte PNG
    Doesn't make any sense to me.

  • Maybe you're using more memory than you think on a real device in other things.

    What are you using for a data source in the sim? playing back a .fit from one of your activities or using "simulated data"? Simulated data is nice if you want to run for a long time, but for specific activities, you may want to playback a .fit. And with playing back a fit, you probably want to use one that was recorded at 1sec vs smart.
  • On the sim, I'm using its "FIT Data > Simulate data", which is being delivered at 1Hz, just like the GPS on the device, so I don't see that as a source of the extra 12,900 bytes.
    But anyhow, why would drawing a 500 byte PNG from a base of 120,740 Byte base cause an out of memory error? The device supposedly has 124 X 1028 = 127472 available.
  • The app itself does have 128K, but starting with CIQ2, about 4K of that is used by the VM. See the bottom line in the sim. I see a max of 124.1kb right now with one of my apps.with a vahr target (the latest SDK)

    Simulated data is more for running and cycling. For real testing, I playback .fit file. My own, or ones I got from others, as it's not just GPS location, but speed, distance. other sensors, etc. It also allows you to easily reproduce things while testing.
  • The app itself does have 128K, but starting with CIQ2, about 4K of that is used by the VM. See the bottom line in the sim. I see a max of 124.1kb right now with one of my apps.with a vahr target (the latest SDK)

    What I see on the bottom line of the sim is 124kB - that's 124 * 1024 = 127472. Where do you see 4K for the VM?

    Simulated data is more for running and cycling. For real testing, I playback .fit file. My own, or ones I got from others, as it's not just GPS location, but speed, distance. other sensors, etc. It also allows you to easily reproduce things while testing.

    That may be true for your apps, but I'm only using the GPS data, so I don't follow your point at all. Anyway, for "real" testing, I use my own code to retrieve and process a pre-recorded GPS data from a .gpx file. This may be one I created on a previous race, or downloaded from a separate device. I'm only using the sim's data to demonstrate a point.

    But why do I see 120744 on the device and 107816 on the sim? That's a massive 12,928 bytes (or 12.6kB) difference.
  • I've looked at Devices.xml and find an entry for fenix5
    <app_types>

    <app id="watchface"memory_limit="98304"/>
    <app id="watch-app"memory_limit="131072"/>
    <app id="widget"memory_limit="65536"/>
    <app id="datafield"memory_limit="32768"/>
    <app id="background"memory_limit="32768"/>
    </app_types>

    Now 131072 is 128K, and, as you say, we see 124kB on the sim. So that's where you're getting the "4K of that is used by the VM".
    But , as I said, 124kB is 127,472 bytes and I'm running out of memory at 120,774. There should still be 7,000 odd bytes in which to display my 550 byte image.