Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    different memory size

    Scheduled Pinned Locked Moved LoPy
    memory size
    3 Posts 3 Posters 570 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L Offline
      ltn22
      last edited by

      Hi,

      I'm running this simple program is two different LoPy

      import gc

      gc.collect()
      print (gc.mem_free())

      I got 65024 in one LoPy and 57488 in another. What explains the difference in memory ?
      Different hardware version, different upgrade ?

      Thanks

      Laurent

      L C 2 Replies Last reply Reply Quote 0
      • L Offline
        livius @ltn22
        last edited by livius

        @ltn22
        do you have some files there - especially boot.py or main.py?
        And yes, different firmware can cause different memory consumption.

        think about people first, then computers

        1 Reply Last reply Reply Quote 0
        • C Offline
          crumble @ltn22
          last edited by

          @ltn22 your are calling this method not on a bare metal system.

          There is an operating system running in the background and on top of it runs python. Each of them needs some memory to run. You can try to disable all radio devices, background tasks and place the your script in main.py to get rid of different timings by typing. But even your chance to see the same amount of free memory is low. There will be always small differences in the state of your LoPys which can result in a different memory usage.

          How well the collect can clean up your unused memory depends on the implementation. You can try to call collect multiple times and wait between the calls. But each additonal (high level) statement may result in a different state of the whole system.

          If you have trouble to get free memory for storing large arrays, there will be another problem. Fragmentation. mem_free may show you enough memory, but most likely this memory will not be available in one huge chunk. There will be a mixture of small and huge blocks depending on what was running before and if the garbage collector is able to move still allocated objects inside the memory.

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom