• Ahh, ok - so the reason GPS and Serial4 are so big is because they're linking to each other... So I guess Serial4 has a callback that references GPS, and vice versa.

    What about trying:

    function show(d) {
      for (var i in d) print(i+" : "+E.getSizeOf(d[i]))
    }
    console.log("--------- gps");
    show(gps);
    console.log("--------- Serial4");
    show(Serial4);
    

    ... and maybe drill down with show(gps.whatever); to try and find out which part of them is taking all the memory?

  • Yes, you are probably right and I have to understand something like 'this' in event context...

    Here is the result of your proposition. Note on the last commands that I failed to list the event handlers defined with gps.on and Serial4.on...
    Sorry for the curious display induced by sharp characters in event names.

    >    show(gps);
    serial : 1943
    GPGGA : 1943
    GPRMC : 1943
    GPGBS : 1943
    line : 1
    enabled : 1
    log : 1
    debug : 1
    chrono : 127
    lagTime : 1
    status : 1
    hhmmss.ss : 1
     [#onGPSFix](http://forum.espruino.com/se­arch/?q=%23onGPSFix) : 1943
     [#ongpsdata](http://forum.espruino.com/s­earch/?q=%23ongpsdata) : 1943
    latitude : 1
    longitude : 1
    sogKn : 1
    ddmmyy : 1
    mslAlt : 1
    std_lat : 1
    std_alt : 1
    epoch : 1
     [#onTimeFix](http://forum.espruino.com/s­earch/?q=%23onTimeFix) : 66
    =undefined
    

    And

    >    show(Serial4);
    _baudrate : 1
    _options : 5
     [#ondata](http://forum.espruino.com/sear­ch/?q=%23ondata) : 1951
    =undefined
    >show(Serial4.#ondata)
    Uncaught SyntaxError: Got '#' expected ID
     at line 1 col 14
    show(Serial4.#ondata)
                 ^
    

    Digging inside failed due to events handlers names...

    >show(Serial4.'#ondata')
    Uncaught SyntaxError: Got String:'#ondata'ID expected ID
     at line 1 col 14
    show(Serial4.'#ondata')
                 ^
    >show(Serial4['#ondata'])
    =undefined
    >show(Serial4[#ondata])
    Uncaught SyntaxError: Got '#' expected EOF
     at line 1 col 14
    show(Serial4[#ondata])
                 ^
    >show(gps[#onGPSFix])
    Uncaught SyntaxError: Got '#' expected EOF
     at line 1 col 10
    show(gps[#onGPSFix])
             ^
    >show(gps[onGPSFix])
    Uncaught ReferenceError: "onGPSFix" is not defined
     at line 1 col 10
    show(gps[onGPSFix])
             ^
    >show(gps['onGPSFix'])
    =undefined
    >show(gps['#onGPSFix'])
    =undefined
    > 
    
About

Avatar for Gordon @Gordon started