Garbage collecting in Lua…

Home Forums General Programming Garbage collecting in Lua…

Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #83218
    proton
    Participant
      • Topics: 19
      • Replies: 94
      • Total: 113
      • ★★

      Hi folks,

      small issue here: I have noticed that after few hours of running my panel/s the size of the app is growing and growing. It usually starts with around 300MB but after few hours it grows to few GBs. There is a lot of MIDI back and forth, labels changing names, SysEx streams etc. and with a time bytes are piling up.
      Are you guys using a system to get rid of the garbage during the usage of a panel or is the restart the only solution to avoid the lag in performance? I use a lot of Lua in my panel, any idea how to “force” Lua to collect the garbage? Assigning variables to nil maybe?
      Any ideas?
      Thanks and Happy Easter time!

      Cheers!

      #83229
      dasfaker
      Keymaster
        • Topics: 80
        • Replies: 793
        • Total: 873
        • ★★★

        Are you using memoryBlocks? Check if you’re creating memoryBlocks and not deleting them.

        #83233
        proton
        Participant
          • Topics: 19
          • Replies: 94
          • Total: 113
          • ★★

          Hi desfaker,

          nope, no memoryBlocks in any of the panels in question. Just reading values, passing them to labels, sending some Sysex when a particular track is being selected etc. I use Lua to recognize what midi note was played on the midi keyboard and harmonize the incoming pitches using some harmonic rules I wrote for that purpose. I use a lot of tables thou to store the currently selected settings and to recall them later, kinda basic “preset” storing and recalling. The panel uses around 700 modulators altogether and most of them send values to tables when there is a need for a “preset” storing. Might this be the issue?
          Cheers!

          #83234
          dasfaker
          Keymaster
            • Topics: 80
            • Replies: 793
            • Total: 873
            • ★★★

            This is a memory leak, you could be creating table duplicates, who knows. You have to find out where the memory is going.

            #83280
            human fly
            Participant
              • Topics: 124
              • Replies: 1070
              • Total: 1194
              • ★★★★

              This is a memory leak, you could be creating table duplicates, who knows. You have to find out where the memory is going.

              could you explain about deleting memory blocks, and show how?
              also curious about duplicate tables: my panel creates tables
              with _G[ "(table name)"..etc ] quite a lot, and i get the
              impression operations can slow down after a bit.

              i initialize and rebuild these tables each time they are used,
              eg:
              _G[ "(table name)"..etc ]={}
              before collecting values again, and re-doing table.insert,
              so i thought that would be ok. have not checked file size,
              doing this – how would i do that while the panel is running?

            Viewing 5 posts - 1 through 5 (of 5 total)
            • The forum ‘Programming’ is closed to new topics and replies.
            There is currently 0 users and 88 guests online
            No users are currently active
            Forum Statistics
            Threads: 2,495, Posts: 17,374, Members: 77,605
            Most users ever online was 12 on January 22, 2019 3:47 pm
            Ctrlr