diff --git a/!!!GarbageProtector/GarbageProtector.lua b/!!!GarbageProtector/GarbageProtector.lua index 49da28a..4c23e6d 100644 --- a/!!!GarbageProtector/GarbageProtector.lua +++ b/!!!GarbageProtector/GarbageProtector.lua @@ -217,12 +217,44 @@ end --UpdateAddOnMemoryUsage is a waste of time and some addons like Details call it periodically for no apparent reason --this hook makes memory profiling addons that call GetAddOnMemoryUsage show 0 or the last returned value of course +-- UpdateAddOnMemoryUsage: nur für Whitelist durchlassen local oldUpdateAddOnMemoryUsage = UpdateAddOnMemoryUsage + +local function IsUpdateMemWhitelisted() + local stack = debugstack(3, 3, 0) or "" + + -- feste Defaults + if stack:find("Interface\\FrameXML\\", 1, true) then return true end + --if stack:find("Interface\\AddOns\\ACP\\", 1, true) then return true end + + -- optional: eigene Whitelist in SavedVariables + if type(GarbageProtectorDB) == "table" and type(GarbageProtectorDB.UpdateMemWhitelist) == "table" then + for _, pat in ipairs(GarbageProtectorDB.UpdateMemWhitelist) do + if type(pat) == "string" and pat ~= "" and stack:find(pat, 1, true) then + return true + end + end + end + + return false +end + _G.UpdateAddOnMemoryUsage = function(...) - if GarbageProtectorDB == nil or GarbageProtectorDB.Enabled == nil or GarbageProtectorDB.HandleUpdateAddOnMemoryUsage == nil then - InitializeGarbageProtectorDB(defaults) - end - if GarbageProtectorDB.HandleUpdateAddOnMemoryUsage == false or GarbageProtectorDB.Enabled == false then - return oldUpdateAddOnMemoryUsage(...) - end -end \ No newline at end of file + if GarbageProtectorDB == nil + or GarbageProtectorDB.Enabled == nil + or GarbageProtectorDB.HandleUpdateAddOnMemoryUsage == nil + then + InitializeGarbageProtectorDB(defaults) + end + + if GarbageProtectorDB.Enabled == false + or GarbageProtectorDB.HandleUpdateAddOnMemoryUsage == false + then + return oldUpdateAddOnMemoryUsage(...) + end + + if IsUpdateMemWhitelisted() then + return oldUpdateAddOnMemoryUsage(...) + end + -- sonst blocken = nichts tun +end diff --git a/!!!GarbageProtector/Localization.lua b/!!!GarbageProtector/Localization.lua index 07d2bf1..fd0843a 100644 --- a/!!!GarbageProtector/Localization.lua +++ b/!!!GarbageProtector/Localization.lua @@ -49,6 +49,33 @@ L["toggle whether GP should handle UpdateAddOnMemoryUsage calls (makes GetAddOnM if GAME_LOCALE == "deDE" then +L["Eanbled"] = "Aktiviert" +L["Disabled"] = "Deaktiviert" +L["Handling |cffffd700%s|r calls is now %s."] = "Verarbeitung von |cffffd700%s|r-Aufrufen ist jetzt %s." + +L.EnabledTooltip = [[ +Diese Option steuert, ob die von GarbageProtector installierten Hooks zur Laufzeit aktiv sind. +Die betroffenen Funktionen werden beim Laden des Addons in jedem Fall gehookt. +Um das Hooking vollständig zu unterbinden, muss GarbageProtector über die Addon-Verwaltung deaktiviert und das UI neu geladen werden. +]] + +L["Handle |cffffd700%s|r calls"] = "Verarbeitung von |cffffd700%s|r-Aufrufen" +L.CollecteGarbageTooltip = "Weg mit diesen r\195\188cksichtslosen collectgarbage-Aufrufen! Ja!" + +L.UpdateAddOnMemoryUsageTooltip = [[ +UpdateAddOnMemoryUsage ist eine Verschwendung von CPU-Zeit, und einige Addons rufen es periodisch auf, obwohl sie es nicht sollten. +Diese Option steuert, ob der UpdateAddOnMemoryUsage-Hook von GarbageProtector die Ausführung verhindern soll. + +Warnung: Alle im Spiel abgefragten Speichernutzungswerte per GetAddOnMemoryUsage werden entweder als 0 oder als zuletzt zurückgegebener Wert angezeigt, wenn diese Option aktiviert ist. +]] + +L["Acceptable commands:"] = "Zul\195\164ssige Befehle:" +L["open the options interface"] = "Optionenfenster \195\182ffnen" +L["list CLI slash commands"] = "Liste der verf\195\188gbaren Slash-Befehle" +L["toggle whether GP should handle any function calls"] = "Schaltet die globale Funktionsverarbeitung durch GP ein oder aus." +L["toggle whether GP should handle collectgarbage calls (prevents collectgarbage calls for slow full garbage collection cycles)"] = "collectgarbage-Aufrufe durch GP blockieren (vermeidet Lag durch GC)" +L["toggle whether GP should handle UpdateAddOnMemoryUsage calls (makes GetAddOnMemoryUsage always return 0 or the last returned value)"] = "UpdateAddOnMemoryUsage blockieren (GetAddOnMemoryUsage gibt 0 oder alten Wert zur\195\188ck)" + elseif GAME_LOCALE == "esES" then elseif GAME_LOCALE == "esMX" then @@ -89,4 +116,4 @@ elseif GAME_LOCALE == "zhCN" then elseif GAME_LOCALE == "zhTW" then -end \ No newline at end of file +end