• So, I just have a problem which cause is very unclear to me.
    There are no memory leakage for hours and it suddenly appears, or most of the time, never happens.
    And that's without any change to the source code of course.

    Whenever it happens, it is immediately precedeed by Jsvar length problems...
    I do not see why it happens, except either some interpreter internal problem or some real time kind of problem.
    I suspect a serial buffer overflow as the serial speed is set to 115200 bauds and the ublox NEO-6M sends data in chuncks which can be fairly long (115 chars for PUBX,00 nmea sentence for instance).

    So, my code now reduces the types of nmea sentences that the ublox gps device can send. This is a ublox feature which allows to inhibate nmea sentences by sending some specific commands to the ublox. This greatly helps as the error did not showed again since this.

    Anyway, following @Gordon suggestions about debugging, I had the following uncoherent results.
    Specifically, the gps and Serial4 objects should not be that big and even fit to RAM if I don't misunderstand the figures.

    >for (var i in global) print(i+" : "+E.getSizeOf(global[i]))
    Chrono : 108
    ddmmyy : 37
    E : 1
    secn : 41
    lln : 40
    cks7 : 27
    nmea_checksum : 54
    start_stop_nmea : 84
    fieldsOfInterest : 31
    codeFieldOfInterest : 44
    posFieldsOfInterest : 26
    getFieldsPos : 8
    parseHandlers : 124
    estimate_dist : 25
    tfTimeout : 1
    tf : 66
    connect : 183
    gps : 1902
    Serial : 6
    Serial4 : 1903
    console : 1
    Number : 1
    Date : 6
    Error : 6
    seconds : 1
    i : 1
    =undefined
    >process.memory();
    ={ "free": 806, "usage": 1444, "total": 2250, "history": 479,
      "stackEndAddress": 536910664, "flash_start": 134217728, "flash_binary_end": 228576, "flash_code_start": 134449152, "flash_length": 262144 }
    >
    

    The source code file is joined.

    >reset();
    =undefined
     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v80.346 Copyright 2015 G.Williams
    >echo(0);
    Handler of GPGGA defined as function (d) {this['hhmmss.ss']=secn(d[1]);this['lati­tude']=lln(d[2],d[3],'S');this['longitud­e']=lln(d[4],d[5],'E');this['mslAlt']=Nu­mber(d[9])}
    Handler of GPRMC defined as function (d) {this['hhmmss.ss']=secn(d[1]);this['stat­us']=d[2];this['latitude']=lln(d[3],d[4]­,'S');this['longitude']=lln(d[5],d[6],'E­');this['sogKn']=Number(d[7]);this['ddmm­yy']=ddmmyy(d[9])}
    Handler of GPZDA defined as function (d) {this['hhmmss.ss']=secn(d[1])}
    Handler of GPGLL defined as function (d) {this['latitude']=lln(d[1],d[2],'S');thi­s['longitude']=lln(d[3],d[4],'E');this['­hhmmss.ss']=secn(d[5]);this['status']=d[­6]}
    Handler of GPVTG defined as function (d) {this['sogKn']=Number(d[5])}
    Handler of GPGRS defined as function (d) {this['hhmmss.ss']=secn(d[1])}
    Handler of GPGBS defined as function (d) {this['hhmmss.ss']=secn(d[1]);this['std_­lat']=Number(d[2]);this['std_alt']=Numbe­r(d[4])}
    Handler of GPGST defined as function (d) {this['hhmmss.ss']=secn(d[1]);this['std_­lat']=Number(d[6]);this['std_long']=Numb­er(d[7]);this['std_alt']=Number(d[8])}
    Handler of PUBX00 defined as function (d) {this['hhmmss.ss']=secn(d[2]);this['lati­tude']=lln(d[3],d[4],'S');this['longitud­e']=lln(d[5],d[6],'E')}
    Handler of PUBX04 defined as function (d) {this['hhmmss.ss']=secn(d[2]);this['ddmm­yy']=ddmmyy(d[3])}
    Now stopping the GPS from sending the following messages
    Time fix from serial at 1442570315.18200206756
    GPS position fix from serial at 1442570315.18380546569
    Received a TimeFix event with parameter GPRMC,095836.00,A,4540.02704,N,00624.519­71,E,0.625,,180915,,,A
    Internal clock was only 348.32958984375 ms from GPS epoch Fri Sep 18 2015 09:58:35 GMT+0000 so no changes were made.
    We have a GPS position fix!
    Stopping GPGSV nmea sentence send by ublox gps with $PUBX,40,GSV,0,0,0,1,0,0*58
    Stopping GPGSA nmea sentence send by ublox gps with $PUBX,40,GSA,0,0,0,1,0,0*4F
    Stopping GPDTM nmea sentence send by ublox gps with $PUBX,40,DTM,0,0,0,1,0,0*47
    Stopping PUBX03 nmea sentence send by ublox gps with $PUBX,40,03,0,0,0,1,0,0*19
    Stopping PUBX40 nmea sentence send by ublox gps with $PUBX,40,40,0,0,0,1,0,0*1E
    Stopping GPTXT nmea sentence send by ublox gps with $PUBX,40,TXT,0,0,0,1,0,0*42
    Now stopping the GPS from sending the following messages
    =undefined
    Stopping GPZDA nmea sentence send by ublox gps with $PUBX,40,ZDA,0,0,0,1,0,0*45
    Stopping GPGLL nmea sentence send by ublox gps with $PUBX,40,GLL,0,0,0,1,0,0*5D
    Stopping GPVTG nmea sentence send by ublox gps with $PUBX,40,VTG,0,0,0,1,0,0*5F
    Stopping GPGRS nmea sentence send by ublox gps with $PUBX,40,GRS,0,0,0,1,0,0*5C
    Stopping GPGST nmea sentence send by ublox gps with $PUBX,40,GST,0,0,0,1,0,0*5A
    Stopping PUBX04 nmea sentence send by ublox gps with $PUBX,40,04,0,0,0,1,0,0*1E
    Stopping PUBX00 nmea sentence send by ublox gps with $PUBX,40,00,0,0,0,1,0,0*1A
    >gps.chrono.info()
    674 leaps (mean time 0.01794492031 s). Measured duration/Total duration 5.47%
    =undefined
    > 
    

    1 Attachment

About

Avatar for asez73 @asez73 started