noob question regarding Flash and Memory



  • I know this is pretty basic, but I would appreciate if someone can help me better understand Flash vs memory on the Pycom.

    When you press the board info tab in Pymakr, you see two figures, Flash status and Memory status.

    From what I think, the memory is the storage of the device. If I upload more files to the filesystem, I reduce the amount of memory available on the device.
    And flash is where variables and and libraries are loaded to, accessed, and manipulated during the device’s operation.

    Do I have that correct?

    If this is true, then a library would be stored in the memory, however If I import a library, does it then get loaded into flash? If yes, then it seems I should work to reduce the amount of unnecessary libraries I import. If not, then it shouldn’t have any consequence on flash memory if I import many libraries even I won’t use them? I ask because I do frequently run into crashes which I think have to do with memory issues.



  • @jcaron Thanks for the clarification. Okay, Then how about the second part of my question? If I import a library, does the whole library (including unused functions) get loaded into / waste memory?

    Thanks,
    Troy



  • @troy-salt it’s actually the opposite. Flash memory is persistent storage, like an SSD on a PC (or like a hard disk drive, but a lot faster), or like a USB pen drive.

    Anything you store on the device goes into flash: your .py files (your app, libraries...), any data, logs, etc. Firmware is also stored in flash, as well as non-volatile data (accessed via nvs_set/nvs_get).

    When you run things, they will usually be loaded in memory (RAM). All data manipulated by your program will also be in RAM. RAM contents are lost when you cut power or on reset.



Pycom on Twitter