Simulator crash under Windows 8.1

I'm working on a widget that is basically this:

When initialized, start a timer for "x" minutes

When the timer fires, call a function to issue a makeJsonRequest() to get some data off a website

When "onReceive: is called, grab the data needed, format/storing it in class variables, and then call requestUpdate(); to get it output. (using findDrawableById()...))

So in other words, simple. Every "x" minutes, get some data from a website and display it. In reality, "x" is 5 minutes or more, as the website only has new data every 5 minuues..

Came back from lunch, and the simulator had crashed (per a dialog box from Windows), and nothing odd was in the Console on Eclipse. I put in some println()'s to see entry and exit to functions, and changed the timer down to 1 minute from 5. I could consistently get the crash in about 10 minutes (the 5 minute timer took much longer - like about 60 minutes)

While trying to narrow things down, I basically commented out everything except the makeJsonRequest() call, and the crash of the simulator still happened - and CONSISTENTLY the 10th time that makeJsonRequest() is called in a widget like this...

I'm a newbie to Monkey C, so it's very possible I did something wrong and caused the simulator crash.

Here's the actual call I use (edited the URL)

Comm.makeJsonRequest("http://(myurl)",{}, {}, method(:onReceive));
  • Former Member
    Former Member over 10 years ago
    Exceeding memory limit?
  • Exceeding memory limit?


    per the memory used in the status line of the simulator, it doesn't change. And even it it did, a memory leak in a widget shouldn't crash the simulator.

    Like I said, it could be my code, but even then, it shouldn't crash the simulator.
  • Former Member
    Former Member over 10 years ago
    Most of my crashes occur when trying to use an uninitialized variable.
  • Here is a a striped down version of the code. It just creates the timer and fires off the makeJsonRequest, and uses printLn()'s to show progress, and "loop" to show how many times the call is made. This code has a bogus URL, but the same thing happens with a good URL (I didn't want to post the real one). The timer here is every minute, and the simulator will crash at about 10 minutes, with the last display being the println() for "leaving doComm()". Like I said before, it seems to be only after 9-10 loops does it cause the simulator to crash -

    "in doComm 9
    leave doComm"
    is the last display in the eclipse console.

    using Toybox.WatchUi as Ui;
    using Toybox.Graphics as Gfx;
    using Toybox.System as Sys;
    using Toybox.Lang as Lang;
    using Toybox.Communications as Comm;

    class OneTestView extends Ui.View {
    var timer;
    var loop=1;

    //! Constructor
    function initialize()
    {
    // Set up an update timer
    timer = new Timer.Timer();
    timer.start( method(:onTimer), 1000*60*1, true );

    //fire off an initial comm request
    doComm();
    }

    //! Load your resources here
    function onLayout(dc) {
    setLayout(Rez.Layouts.MainLayout(dc));
    }

    //! Restore the state of the app and prepare the view to be shown
    function onShow() {
    }

    function onTimer()
    {
    //Kick the display update
    //Ui.requestUpdate();
    loop=loop+1;
    doComm();
    }

    //contact the server and get the data
    function doComm()
    {
    Sys.println("in doComm "+loop.toString());
    Comm.makeJsonRequest("bogus.badone.com/wdjson.html",
    {}, {}, method(:onReceive));
    Sys.println("leave doComm");
    }

    //! Update the view
    function onUpdate(dc) {
    Sys.println("in onUpdate "+loop.toString());

    // Call the parent onUpdate function to redraw the layout
    View.onUpdate(dc);
    Sys.println("leave onUpdate");
    }

    function onReceive(responseCode, data)
    {
    Sys.println("in onReceive "+loop.toString()+" r="+responseCode.toString());
    if( responseCode == 200 )
    {

    }
    else
    {

    }
    Ui.requestUpdate();
    Sys.println("leave onReceive");
    }

    //! Called when this View is removed from the screen. Save the
    //! state of your app here.
    function onHide() {
    }

    }
  • We've fixed this and it'll be fixed in a future simulator release. There was an issue with our Windows simulator after making about 10 json request calls.
  • Thanks Kyle - is there an ETA for the fix in the SDK?
  • Unfortunately I don't have an ETA at this time. I understand the annoyance in not being able to make more than a handful of calls per simulator cycle and apologize for the inconvenience.
  • Kyle, as an ETA , can you say if it's weeks or months?
  • I can't confirm an actual date, but I believe we'll be releasing something with simulator fixes in the future. I would say it's not weeks but it's also not months, so somewhere in between.
  • Former Member
    Former Member over 10 years ago
    fortnights