Quantcast WoWInterface - View Single Post - My favourite addon leaks memory
View Single Post
07-07-19, 12:39 AM   #6
A Flamescale Wyrmkin
Join Date: Feb 2018
Posts: 126
I was 99.9% sure it was bad GC, and I wrote a big message yesterday, but then I re-wrote the whole message to make it simpler and forgot to mention the GC in the new edit.

OK so after some experimentation, I recap:

1) My addon leaks memory like a sieve. I presume when it has leaked enough it slows down WoW because it works on screen update, ie very often, and probably with large memory lying about some operations become slower

2) This manifests itself that we go into the raid, all is well, but by the 5th wipe on Rastakhan my screen slows to a crawl, effective 2-3 FPS

3) I discovered that a /reload fixes the issue, magically

4) You told me that my tables are all leaking, every time I do " local myTable = { } ". You suggested to use wipe().

5) I tried to use wipe() but it failed because it does not help with tables inside tables. It also makes the code cumbersome and weird to read.

6) but we can force GC with " collectgarbage(); " - this seems to work beautifully.

Now I am trying to find the best place to put this. From my experience 100 years ago, I remember that you don't want to be calling GC because it blocks all threads and can halt your code for a while. Actually I know of a very, very famous stock exchange, that decided to re-write their code in .. .net, and they had disabled GC for this reason. The exchange needed to be rebooted every evening to reclaim memory.

So, back to WoW, I am slighly worried that if I call GC, it might affect ALL addons, and it might block all addons and threads, just when I am trying to taunt Bwonsamdi or cast Guardian Angel to the tank...

Currently I have added GC during (a) GCD (b) casting (c) not in combat, hoping it should not affect things too much.

Last edited by doofus : 07-07-19 at 01:43 AM.
  Reply With Quote