You are reading a single comment by @d3nd3-o0 and its replies. Click here to read the full conversation.
  • Yes I am trying this :

    function test(i)
    {
      let imgname = `rc${i}.img`;
      console.log(imgname);
      let imgdata = require("Storage").read(imgname);
      if ( !imgdata ) {
        console.log("cant find image");
      }
      try{
        g.drawImage(imgdata);
      } catch(e) {
        try{
          g.drawImage(E.toString(imgdata));
        }
        catch(e) {
          console.log(e);
          console.log("too large to flatstring");
        }
      }
      Bangle.setLCDPower(true);
    }
    
    function hashow() {
      let delay = 1000;
      let hihi = 27;
    for(var lol=1;lol<=hihi;lol++){
      setTimeout(test,delay*lol,lol);
    }
    }
    

    And the memory is just getting more and more full, because of the for loop. Is there a way to free memory within a for loop to run a task like this? Its meant to be a slideshow of images..
    EDIT: its related to using setTimeout within the loop I think, it doesnt activate the garbage collection cos of the setTimeout or something?

About

Avatar for d3nd3-o0 @d3nd3-o0 started