Out of memory?

Posted on
  • I'd be interested to hear what you were doing...

    There's some information on using memory more efficiently here but it'd be great to know what you were trying to do so I can see if there's any way Espruino can be improved.

  • I'm using Espruino to drive a 240 LED Neopixel strip from adafruit (4 meters of http://www.adafruit.com/products/1138). It's working fine so far. Although I've lots of patterns, memory usage & performance are good. Even added the wi-fi module to create a small webinterface for changing colors/patterns.

    BTW: I would like to thank you for all the great tutorials and further development. It's awesome to have such an easy-to-use tool and to have results in minutes.

  • It's awesome to have such an easy-to-use tool and to have results in minutes.

    Yeah second that. Probably it's just the nature of the forum that you hear mostly about problems - and that's the purpose of this thread :) - but some praise can't be bad. For example I was playing with switches recently and was blown away by setWatch(). On Arduino doing timers and debouncing never felt intuitive to me, but on Espruino it's a pleasure. Thanks!

  • Thanks! It is great to hear back when stuff goes well ;)

    If you do something and get a chance, I'd really appreciate if if you could snap a picture and post it in the projects page - it's great for me (and others too!) to see the kind of things that Espruino is being used for.

    There were a few complaints about lack of memory in the RAM expansion thread - but I have a sneaking suspicion that if you're running out of RAM with 48kB, doubling it to 96kB probably isn't going to solve your problems...

  • First of all, I couldn't agree more with the first two comments. Secondly, I just wanted to clarify something. The RAM contains your variables, since functions and prototypes and objects are variables too, so is all code on the espruino on the RAM? Then when you type save() it saves all those to the flash and loads it back into RAM when called with the onInit()? For my project we won't be using very large arrays of data but we do have a lot of code to run. What exactly is on the flash and what can be stored on the SD card?

  • Yes, that's the case.

    In flash it's 90% interpreter, 10% your saved code (which is almost an exact mirror of what's in RAM). There's not much free space available for anything else.

    On the SD card, you can just put files. Those files can contain JavaScript which you run with eval - but you can't 'stream' JavaScript off the SD card. You've got to load it into a string and then execute that string.

  • Hi Gordon,

    My current project is a home automation project with a lot of modules for switches, controls, timers, sensors, displays and so on. The communication is based on the xBee module. On top a communication module with an integration to the FHEM homeautomation system (http://www.fhem.de). The configuration is stored on sd and loaded on startup. When i finished everything i will post it.

    I do not use much simple arrays, the code is well optimised. Everything is minified. For me the space is very tight. Doubling the memory would definitive help without touching the limit again.

    Sacha

  • Hi Gordon,

    I'm using the espruino in combination with a current clamp and log the data to the SD Card. Espruino is my first hardware but it's really fun to work with it, absolutely fantastic! I run out of memory a few times when I do a lot of samples (around 5000 measurements) but as you mentioned this can be fixed when the memory is used more efficiently. I'm looking forward to get more espruino, thanks a lot for the development!

  • I'm in a similar situation as Sacha, though I haven't gotten quite that far - I'm not far enough to actually hit the limit, but only because I've only written code for 1 of the 4 devices that I want to control with that Espruino...

    The memory is mostly going to code (including both the code itself and modules needed), not simple arrays that should be typed.

  • Thanks - that's interesting to know... So generally it's the volume of code that you're writing...

    @DrAzzy - is that with your code minified, or with normal code?

    Do you have an example of the type of code that's being written? It may be that there are some things I could do that would get the code to be stored more efficiently.

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

Out of memory?

Posted by Avatar for Gordon @Gordon

Actions