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

    Memory leak

    Scheduled Pinned Locked Moved LoPy
    6 Posts 3 Posters 1.6k 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.
    • C Offline
      Colateral
      last edited by Colateral

      Hello,

      If you load a module (that contains a class inside) , the memory is not freed. Here is an example:

      PYB: soft reboot
      MicroPython v1.8.6-412-gf55ba50 on 2017-01-28; LoPy with ESP32
      Type "help()" for more information.
      import gc,sys
      gc.mem_free()
      58432
      import onewire
      onewire loaded
      gc.mem_free()
      54128
      gc.collect()
      gc.mem_free()
      54320 <<<< 4k still out
      del sys.modules['onewire']
      gc.collect()
      gc.mem_free()
      54368
      import onewire
      onewire loaded
      gc.mem_free()
      50800 <<<< another 4k out
      import onewire
      gc.mem_free()
      50640
      del sys.modules['onewire']
      gc.collect()
      gc.mem_free()
      51088
      import onewire
      onewire loaded
      gc.mem_free()
      47520 <<<< another 4k out

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @Colateral
        last edited by livius

        @Colateral

        please reformat your post
        look here for format guide
        http://commonmark.org/help/

        but your observation about eating memory should be reviewed by @daniel

        think about people first, then computers

        1 Reply Last reply Reply Quote 0
        • C Offline
          Colateral
          last edited by

          Thank you. Looking forward for some workaround on this .

          1 Reply Last reply Reply Quote 0
          • E Offline
            EA
            last edited by

            Has this issue been solved? I'm getting similar problems with threads that don't free-up memory after finishing execution. My version is:

            >>> os.uname()
            (sysname='LoPy', nodename='LoPy', release='1.13.0.b1', version='v1.8.6-849-656704e on 2018-01-10', machine='LoPy with ESP32', lorawan='1.0.0')
            
            C 1 Reply Last reply Reply Quote 0
            • C Offline
              Colateral @EA
              last edited by

              @ea If you are dealing with threads ... then might be another story. Do you have memory leaks on main execution? I tested on my LopY and everything works fine.

              E 1 Reply Last reply Reply Quote 0
              • E Offline
                EA @Colateral
                last edited by

                Hi @colateral. Thanks for replying. My MemoryError issue was reported in https://forum.pycom.io/topic/2600/threads-generate-memoryerror-when-there-s-an-empty-while-cycle-not-necessarily-infinite/6

                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