ERA report doesn't make sense

Error Name: Out Of Memory Error
Occurrences: 1
First Occurrence: 2023-12-02
Last Occurrence: 2023-12-02
Devices:
fēnix® 6X Pro / 6X Sapphire / 6X Pro Solar / tactix® Delta Sapphire / Delta Solar / Delta Solar - Ballistics Edition / quatix® 6X / 6X Solar / 6X Dual Power: 26.00
App Versions: 2.3.1
Languages: rus
Backtrace:
MyFitContributor.initialize:83
TextAnimation.next:33
MyApp.saveAlias:173

This error doesn't make sense for two reasons:

1. fenix6xpro has 124.5kB memory for datafields (according to the simulator) and my code runs on thousands of watches that have 32kB DF memory only.

2. the backtrace makes no sense at all. TextAnimation is only used in my field (MyField class), and in MyApp.saveAlias it's impossible to get there. Also impossible to get from either saveAlias() or next() to MyFitContributor's constructor

  • Maybe you are running out of memory for what you are doing in fitcontrib.  There's a limit on both the number of fields and the total for what you are trying to write, and it's per activity and not per data field.

    if for example, I have a DF that writes 12 fields, and you have one that also writes 12 fields. they could work fine if used alone, but in the same activity, causes problems.

  • 1. If the number of fields triggers this error then the error is not very useful, because it should say something about the maximum number of fit fields, not the maximum amount of memory...

    2. About the number of fields. IMO that is a bad design, 'cause it looks like neither the developer can do anything about it nor the user could understand the problem (I have no idea how the error message would look other that crash of the one of the DFs) Do you have any idea what to do? Adding try/catch would even catch the error? If it would, then what could I do? Just change the output of my DF to "Remove some other datafield!" ?

    3. BTW I have another error from ERA at the same line:

    Error Name: System Error
    Occurrences: 2
    First Occurrence: 2023-11-16
    Last Occurrence: 2023-11-29
    Devices:
        GPSMAP® 66s / 66sr / 66st: 6.10
        GPSMAP® 66s / 66sr / 66st: 10.70
    App Versions: 2.3.1
    Languages: eng, hrv
    Backtrace:
        MyFitContributor.initialize:83
        MyField.initialize:824
        MyApp.initialize:32

    Here the backtrace makes sense, and it would also make a littlebit more sense in case there are too many fit fields in the activity. So IMHO it still doesn't explain the Out Of Memory Error

  • Understand that an app can run out of memory in different was.  The common ones are the app runs out of memory on it's own, or changing app settings while an app is running.  Others are running out of memory when converting json data from a makeWebRequest() into a dictionary  On CIQ 4 devices, I'm pretty sure the graphics pool can run out of memory.

    Consider this very simple data field (6k out of 252k on a fr965 in the sim). Only one field, and no change of using a second data field.

    import Toybox.Activity;
    import Toybox.Lang;
    import Toybox.Time;
    import Toybox.WatchUi;
    
    class sdfView extends WatchUi.SimpleDataField {
        var f1;
    
        // Set the label of the data field here.
        function initialize() {
            SimpleDataField.initialize();
            label = "My Label";
            f1=createField("f1",0,FitContributor.DATA_TYPE_STRING, {:mesgType => FitContributor.MESG_TYPE_LAP, :count => 10}); 
        } 
    
        // The given info object contains all the current workout
        // information. Calculate a value and return it in this method.
        // Note that compute() and onUpdate() are asynchronous, and there is no
        // guarantee that compute() will be called before onUpdate().
        function compute(info as Activity.Info) as Numeric or Duration or String or Null {
            // See Activity.Info in the documentation for available information.
            f1.setData("abc");
            return 0.0;
        }
    
    }

    It runs fine if :count => 10 on line 13

    but change that to count => 100 and in the sim you get

    Error: Out Of Memory Error
    Details: New Field out of memory for FIT data
    
    Stack: 
      - initialize() at C:\Users\James\workspace-prod\sdf\source\sdfView.mc:13 0x10000123 
      - getInitialView() at C:\Users\James\workspace-prod\sdf\source\sdfApp.mc:21 0x10000042 
    
    Encountered app crash.

    In an ERA, I don't think you'll see the "Details" line, just the out of memory

  • I understand that but that means that it would fail for everyone on every device.

    My DF is used by more than 120k users, and I only have a handful of these errors. So the scenario that another datafields in the same activity can use up the fields can explain the problem, but again it is a problematic decision of Garmin. Developers get errors with different and unrelated error messages they can't fix, users get crashes, that also causes users give bad reviews, etc. Everybody suffers and nobody knows exactly why.

  • It doesn't.  It could be the user is running a 2nd CIQ DF with fitcontrib that doesn't leave the resources your data field is trying to use.

    In other words, another data field could be causing yours to crash.  If I recall, when fitcontrib first came out, Stryd had a data field that used so many fields, that other data fields would crash if they even tried to use one.

  • Exactly, that's what I call a bad design.