Gear 2 app/watchface gets killed

Gear 2 app/watchface gets killed

BY 16 May 2014 General Support

Hi everybody!

I’ve developed my first Gear 2 watchface for testing and I used the sample “ClockWidget”. It’s a digital watchface and I didn’t change the update intervall from the ClockWidget sample so it’s still:

window.setTimeout(callback, 1000 / 60);

Now I recognized that my watchface gets randomly killed, this means the default Gear 2 watchface is shown instead of my watchface.It doesn’t matter if the Gear 2 display is on or off or how low/high the battery is. It just happens….

I analyzed the log. The application gets killed because it used to much memory… This happens extremly fast (after 5 – 10 minutes) when I use a refresh rate of 1000 / 16 for my watchface. But I think the refresh rate doesn’t matter it only extends the time the watch needs to crash…
I shrinked the example code to a minimum only drawing a red square on the screen:

function watch() {
'use strict';

context.fillStyle="#ff0000";
context.fillRect(0, 0, 320, 320);

window.requestAnimationFrame(watch);
}

That’s it. In my onload function I’m getting the canvas and the context…. How can it be that the Gear 2 memory runs full??? I also tried to null all needed variables after each draw call but it doesn’t help.

Here the line from the dlog:

E/RESOURCED( 528): vmpressure-lowmem-handler.c: lowmem_oom_killer_cb(818) > [lowmem_oom_killer_cb,818] we killed, lowmem lv2 = 21752 (vMiFgv8mus.SampleWatch) oom = 100, size = 236836 KB, victim total size = 236836 KB

I really need help…

Thank you!

Written by