Out of memory for code

Posted on
  • Hello! I tried with example INTERACTIVE WEB-BASED UI from tutorials on ESP8266-12 and it seems work OK. But when I changed draw and added some elements and html code grew to 8 kb after file convert, Espruino Web IDE could not to load it and wrote to me out of memory. When I ceased file it began to work partially with the same problem - out of memory. I do not attach code here because it almost the same as in example only the size of html part is bigger then on original. Is it so small limit on program code for ESP8266 ? Only 5 KiloBytes? I have Esp8266-12 with 4 Mb and run on 1.85 version of Espruino.

  • In the webIDE options, change the minifier to closure instead of... whatever the default is.

    That minifier gets rid of all the newlines, so Espruino has to buffer the whole mess, AND the results of executing it. So it stops working at about half-full.

    The ESP8266 doesn't have all that much RAM, and on Espruino, code is stored in RAM (since code is fully manipulatable - this is javascript). There is work ongoing to improve matters here - there are versions in testing with 1600 jsvars available, and work is being done (see the other threads in this section) on storing code in flash.

  • Your other problem could be because you're trying to send the whole HTML page at once - basically if you send the HTML straight down the socket in one go, Espruino needs the RAM for the HTML in the variable and for the HTML that's now in the socket's send buffer.

    You can get around it by sending the string a bit at a time, or even just my using multiple files (eg put any JS in a separate JS file, and the same for CSS)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Out of memory for code

Posted by Avatar for user64943 @user64943