My favourite addon leaks memory
View Single Post
07-08-19, 07:56 AM
A Flamescale Wyrmkin
Join Date: Feb 2018
OK I have traced deeper into the problem and have better news (for me).
WoW was getting progressively slow, to the point of crawling to a halt. It took a couple of hours to reach that point, two hours of trying Rastakhan on Heroic to be precise.
I discovered that a /reload fixed it (after we wiped for the nth time).
I then started to find the culprit, which was my own addon.
I immediately noticed that my addon started at about 700K but during combat it would rise with no apparent let up. This could mean a lazy GC or something more sinister.
After reading your suggestions I realised that any kind of table assignment increases the reported memory (hover mouse over the ?). wipe() did not fix it, nor did using local tables (you'd think local variables get thrown away at the end of the function if no references to them).
I then discovered we can force GC with collectgarbage() and I used it liberally, and my memory consumption went down, however it made the screen jerky, so I removed it.
Finally I found the culprit as being not memory or lazy garbage collection, but my misuse of "CreateFrame", as in
gameTooltip = CreateFrame("GameTooltip", "BA_GameTooltip", UIParent, "GameTooltipTemplate");
which I used to parse the tooltip of Azerite gear in order to find the available traits. 3-4 times a second. This is what causes the screen jerkiness and eventually the slowdown to a crawl. I read on the wiki/gamepedia that you must re-use frames, they cannot be deleted! So I did just this, and all seems to be good.
Memory still seems to be going up, but it was not the reason for the jerkiness and slowdown, it was all those frames I was creating.
View Public Profile
Send a private message to doofus
Find More Posts by doofus