View Single Post
07-06-19, 06:32 PM   #5
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
What Kanegasi said. And you can't always rely on garbage collection for things like strings either, especially during events that trigger much like OnUpdate. Though, garbage collection is slightly more forgiving for strings... if only a little. Addons should have an initialization phase for every table where it's created and at any point you need to reset/reuse, or wipe, it you should use table.wipe.

I'm not sure how they're using the table but a reference/key can be read either as a string or a variable.
Lua Code:
  1. BA_Data1["AAAA1"] == BA_Data1.AAAA1
So
Lua Code:
  1. --upvalue table.wipe for ease of use and performance
  2. local wipe = table.wipe
  3.  
  4. local BA_Data1 = {}  -- should be the only place you set it as a table
  5.  
  6. -- stuff happens
  7.  
  8. BA_Data1.AAAA1 = wipe(BA_Data1.AAAA1) -- that should solve the memory issue
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison

Last edited by jeruku : 07-06-19 at 06:45 PM. Reason: I never feel like I convey my messages right.
  Reply With Quote