You are reading a single comment by @ClearMemory041063 and its replies. Click here to read the full conversation.
  • Trying process.memory to attempt a debug

    //xtest2.js 27 Jan2018
    // trying this on a Pico
    //try changing the value of chk
    
    // process.memory uncommented =PM
    // comment out process.memory =NPM
    ///
    // chk=1*1024 works both cases
    // chk =2*1024 works with PM,fails NPM
    // chk=25*1024 works with PM, fails NPM
    // chk=26*1024 fails just too big
    var n =100, chk=25*1024; 
    var tdata=new Uint8Array(chk);
    
    function xsend(a){
      console.log(n,a.length);
    //  process.memory();// this makes it work
    }//end xsend
    
    function test(){
    var a;
    while (n){
      xsend(E.toString(tdata)); //fails if no process.memory
      n--;
    }
    }//end test
    
    setTimeout(function () {
     test();
    }, 1000);
    

    The process.memory() fixes the bug.

     1v95 Copyright 2017 G.Williams
    >
    =undefined
    100 25600
    99 25600
    98 25600
    97 25600
    Uncaught Error: Field or method "length" does not already exist, and can't create it on undefined
     at line 16 col 16
    console.log(n,a.length);
                   ^
    in function "xsend" called from line 23 col 26
      xsend(E.toString(tdata)); //fails if no process.memory
                             ^
    in function "test" called from line 1 col 6
    test();
         ^
    in function called from system
    > 
    
About