Hello,
Creating an addon page and the addon memory usage keeps increasing by 2k until it performs automatic garbage collection.
What am I doing wrong, if anything ?
local AddonName, Addon = ...
local C_VignetteInfo = C_VignetteInfo;
local GetVignetteInfo = C_VignetteInfo.GetVignetteInfo;
local GetVignettes = C_VignetteInfo.GetVignettes
local man = {}
local msgFrame = msgFrame or CreateFrame("FRAME", nil, UIParent, "BackdropTemplate")
function Addon:MJBBlah(msg, k)
man.msgFrame = msgFrame
msgFrame:SetWidth(300)
msgFrame:SetHeight(14 * k + 20)
msgFrame:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 50, -300)
msgFrame:SetFrameStrata("TOOLTIP")
msgFrame:SetBackdrop({
bgFile = "Interface/BUTTONS/WHITE8X8",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 32, edgeSize = 16,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
})
msgFrame:SetBackdropColor(0.1,0.1,0.1, 1)
msgFrame.text = msgFrame.text or msgFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
msgFrame.text:SetPoint("TOP", 0,-10)
msgFrame.text:SetJustifyH("LEFT")
msgFrame.text:SetText(msg)
end
Addon:MJBBlah("Why is this eating resources?!",2)
local EL = EL or CreateFrame("Frame", "", UIParent);
EL:RegisterEvent("UPDATE_UI_WIDGET");
EL:RegisterEvent("VIGNETTES_UPDATED");
EL:RegisterEvent("VIGNETTE_MINIMAP_UPDATED");
EL:RegisterEvent("PLAYER_ENTERING_WORLD");
EL:RegisterEvent("ZONE_CHANGED");
EL:RegisterEvent("ZONE_CHANGED_NEW_AREA");
local as = "";
local text = text or UIParent:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
EL:SetScript("OnEvent",function(self,event, ...)
Addon:MJBBlah(event,2)
end)
This is a simple code just to show my issue. This was what I used to “debug”…
If I comment out the EL:SetScript, memory is not constantly used. But as soon as I add it, memory usage increased incrementally.
Even with Addon:MJBBlah(event,2) commented out, memory increases.
Sigh
Is that just a part of the OnEvent / SetScript functions ?
Thanks,
Mike