From 7beff1c4caabb4a12e5b31e04ac48f5b72166051 Mon Sep 17 00:00:00 2001 From: Bluewhale1337 <295648290+Bluewhale1337@users.noreply.github.com> Date: Sun, 13 Sep 2026 20:09:46 +0200 Subject: [PATCH] Fix: expand table pooling across modules to reduce garbage collection --- HealBotBlue.toc | 2 +- HealBot_Action.lua | 6 ++++-- HealBot_Controller_Aura.lua | 3 ++- HealBot_Controller_Spells.lua | 3 ++- HealBot_Integrations.lua | 7 +++++-- HealBot_Model.lua | 3 ++- HealBot_View_Layout.lua | 3 ++- README.md | 3 +++ 8 files changed, 21 insertions(+), 9 deletions(-) diff --git a/HealBotBlue.toc b/HealBotBlue.toc index 96d1a22..30b9bda 100644 --- a/HealBotBlue.toc +++ b/HealBotBlue.toc @@ -1,6 +1,6 @@ ## Interface: 11200 ## Title: HealBotBlue -## Version: 1.7.2 +## Version: 1.7.3 ## Author: Bluewhale ## Notes: Raidframe replacement for healing, decursing, resource tracking and buffing with optional support for SuperWow, ClassicAPI, UnitXP_SP3 and Nampower. ## SavedVariablesPerCharacter: HealBot_Config diff --git a/HealBot_Action.lua b/HealBot_Action.lua index 69ef209..207d7ad 100644 --- a/HealBot_Action.lua +++ b/HealBot_Action.lua @@ -136,9 +136,10 @@ end -- HealBot_SplitString: Internal utility: HealBot_SplitString function HealBot_SplitString(str, delimiter) - local result = {} + local result = HealBot_GetTable() if not delimiter or delimiter == "" then - return {str} + table.insert(result, str) + return result end local start_pos = 1 while true do @@ -160,6 +161,7 @@ function HealBot_RunMacroText(body) ChatFrameEditBox:SetText(commands[i]) ChatEdit_SendText(ChatFrameEditBox) end + HealBot_ReleaseTable(commands) end -- HealBot_RunMacro: Internal utility: HealBot_RunMacro diff --git a/HealBot_Controller_Aura.lua b/HealBot_Controller_Aura.lua index 3757ab8..d3decfe 100644 --- a/HealBot_Controller_Aura.lua +++ b/HealBot_Controller_Aura.lua @@ -184,7 +184,7 @@ function HealBot_OnEvent_UnitAura(this, unit) local iconCount = 0 local i = 1; HealBot_UnitDebuff[unit] = nil; - local trackedTextures = {} + local trackedTextures = HealBot_GetTable() while true do local debuff, tmp, debuff_type = UnitDebuff(unit, i, 1) @@ -301,5 +301,6 @@ function HealBot_OnEvent_UnitAura(this, unit) -- Defer UI updates HealBot_View_DirtyUnits[unit] = true + HealBot_ReleaseTable(trackedTextures) end end diff --git a/HealBot_Controller_Spells.lua b/HealBot_Controller_Spells.lua index b248a76..eb11850 100644 --- a/HealBot_Controller_Spells.lua +++ b/HealBot_Controller_Spells.lua @@ -472,7 +472,7 @@ function HealBot_FindHealSpells() end end); - local items = {}; + local items = HealBot_GetTable(); for bag = 0, NUM_BAG_FRAMES do for slot = 1, GetContainerNumSlots(bag) do local item = HealBot_GetItemName(bag, slot); @@ -498,6 +498,7 @@ function HealBot_FindHealSpells() HealBot_Heals["raidpet" .. i] = HealBot_Heals.party; end + HealBot_ReleaseTable(items); if HealBot_CalcEquipBonus then HealBot_AddDebug("...Done Equip Bonus:" .. RealHealing); end diff --git a/HealBot_Integrations.lua b/HealBot_Integrations.lua index 4dd03b3..42ac6c2 100644 --- a/HealBot_Integrations.lua +++ b/HealBot_Integrations.lua @@ -44,7 +44,7 @@ function HealBot_Integrations_Toggle() if not spellName then return end if not HealBot_Nampower_Auras[target] then - HealBot_Nampower_Auras[target] = {} + HealBot_Nampower_Auras[target] = HealBot_GetTable() end local expirationTime = GetTime() + (duration / 1000) @@ -61,7 +61,8 @@ function HealBot_Integrations_Toggle() HealBot_Integrations_Nampower_Active = false; HealBot_AddDebug("nampower Integration: DISABLED"); if HealBot_Nampower_Auras then - for k in pairs(HealBot_Nampower_Auras) do + for k, v in pairs(HealBot_Nampower_Auras) do + HealBot_ReleaseTable(v) HealBot_Nampower_Auras[k] = nil end end @@ -76,6 +77,7 @@ function HealBot_Integrations_PruneNampower() for targetName, auras in pairs(HealBot_Nampower_Auras) do -- Check if target is still in the raid/party if not HealBot_Model:GetUnitIDByName(targetName) then + HealBot_ReleaseTable(auras) HealBot_Nampower_Auras[targetName] = nil else -- Prune expired auras @@ -88,6 +90,7 @@ function HealBot_Integrations_PruneNampower() end end if not hasAuras then + HealBot_ReleaseTable(auras) HealBot_Nampower_Auras[targetName] = nil end end diff --git a/HealBot_Model.lua b/HealBot_Model.lua index 2114e4f..e3fdfa8 100644 --- a/HealBot_Model.lua +++ b/HealBot_Model.lua @@ -245,7 +245,8 @@ function HealBot_Model:PreserveStateByGUID() for targetUnit, stateData in pairs(stateSwaps) do -- Deep copy to prevent memory aliasing if not self.units[targetUnit] then - self.units[targetUnit] = { icons = {} } + self.units[targetUnit] = HealBot_GetTable() + self.units[targetUnit].icons = HealBot_GetTable() end local targetIcons = self.units[targetUnit].icons diff --git a/HealBot_View_Layout.lua b/HealBot_View_Layout.lua index efd88ac..c02bbde 100644 --- a/HealBot_View_Layout.lua +++ b/HealBot_View_Layout.lua @@ -1153,7 +1153,7 @@ end function HealBot_Action_AppendNewUnits() if not HealBot_Grid_LastI then return end - local unitsToCheck = {} + local unitsToCheck = HealBot_GetTable() -- Gather units based on config, similar to PartyChanged if HealBot_Config.GroupHeals == 1 then @@ -1220,4 +1220,5 @@ function HealBot_Action_AppendNewUnits() HealBot_Action_AppendUnit(unit) end end + HealBot_ReleaseTable(unitsToCheck) end diff --git a/README.md b/README.md index f6f3853..30f3c00 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,9 @@ Default installation path: `C:\Program Files\World of Warcraft\Interface\AddOns\ ### Change Log +**v1.7.3** +* **Performance Fix - Table Pooling Part 2** - Fixed remaining un-pooled table allocations in layout updates, macro parsing, nampower integration, and aura tracking by utilizing HealBot_GetTable(). + **v1.7.2** * **Performance Fix - Table Pooling** - Fixed massive Vanilla Lua 5.0 garbage collection memory leaks caused by unbounded table allocations in high-frequency update loops (e.g., `OnUpdate` and `PreserveStateByGUID`). Moved tables to file-local scope and implemented inline clearing. * **Performance Fix - OOC Cleanup** - Added an out-of-combat garbage collection hook (`PLAYER_REGEN_ENABLED`) to purge disconnected senders from the `HealBot_IncomingHealers` global table, preventing memory bloat during prolonged play sessions.