mirror of
https://github.com/Bluewhale1337/HealBotBlue.git
synced 2026-09-13 18:41:04 +00:00
Fix: expand table pooling across modules to reduce garbage collection
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
+4
-2
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+2
-1
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user