available memory in puckjs for data collection

Posted on
  • Hi,

    I used the Data Collection example from:
    https://www.espruino.com/Data+Collection

    If I save the example code with save(); I get this result:
    Compressed 36000 bytes to 2643

    Which is saved to RAM if I'm correct. There is 64kB of RAM available, so this we will have plenty of room left.

    There is 512kB Flash memory as well.

    Does this mean I have 512kB of Flash memory available for data collection?

    Thanks, Regards, Peter

  • Not really, most of flash and memory is utilised by Espruino.
    If you save() your code, it's saved to flash, but still uses some memory. But less than executing directly from memory.
    To get the available free memory, use process.memory(). The free is the available memory in Espruino's "jsVars". If storage matters, take a look at typed arrays: (U)Int8Array, (U)Int16Array.
    You can qurey the available flash with Storage.getFree it's about 40k on the Puck.

    Or add an SD card, and you have as much space as big your SD card is. And it's easier to read: Just pop in your computer, and read it!

  • Thr 2019.12.26

    'your SD card is. And it's easier to read: Just pop in your computer, and read it!'

    Or, pick up a WiFi SD card and just link to it!!

    (I extract photo images from a digital camera this way - it is slick not having to remove and re-insert the card each time)


    'Compressed 36000 bytes to 2643'

    For clarification: this refers to code compression during the save() process, not data.

    as the next statement refers to data storage 'Which is saved to RAM if I'm correct' . . . which is of course a wrong interpretation


    'If I save the example code with save(); I get . . . . Which is saved to RAM if I'm correct?'

    I believe the understanding there (#1 post) is backwards.

    Ref the following:

    https://www.espruino.com/Reference#l__global_save
    https://www.espruino.com/Saving

    'When you upload code to Espruino normally, it is stored in Espruino's RAM'
    and
    'However it's easy to save your code to flash memory and make it permanent. Just type save()'



    Fully understanding how a JsVar fits in, can be daunting

    https://www.espruino.com/Internals

    a really, really rough rule of thumb would be to multiply the 'free' space by ten (actually 12 or 16 depending on many coding factors), our human mental model, for a really rough approximation of free RAM in bytes for data collection.

    https://www.espruino.com/Reference#l_process_memory

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

available memory in puckjs for data collection

Posted by Avatar for Dutch_Peter @Dutch_Peter

Actions