- Joined
- May 9, 2014
- Messages
- 1,819
A simple snippet that might help the mapmakers check out the potential of memory leaks.
Applicable only to v.1.31.
To activate the snippet, call CreateOverwatch before MonitorOverwatch.
Applicable only to v.1.31.
Lua:
do
local _frame
local text = "|cffff40ffMemory Used (kB):|r "
function CreateOverwatch()
if _frame then
return
end
local world = BlzGetOriginFrame(ORIGIN_FRAME_GAME_UI, 0)
_frame = BlzCreateFrameByType("TEXT", "GarbageMonitor", world, "", 0)
BlzFrameSetSize(_frame, 0.12, 0.05)
BlzFrameSetAbsPoint(_frame, FRAMEPOINT_TOPRIGHT, 0.80, 0.45)
BlzFrameSetScale(_frame, 1.25)
BlzFrameSetText(_frame, text)
BlzFrameSetEnable(_frame, false)
BlzFrameSetFocus(_frame, false)
BlzFrameSetText(_frame, text .. tostring(math.floor(collectgarbage('count'))))
end
function MonitorOverwatch()
if not _frame then
return
end
local timer = CreateTimer()
TimerStart(timer, 0.01, true, function()
local mem = collectgarbage('count')
mem = math.floor(mem)
BlzFrameSetText(_frame, text .. tostring(mem))
end)
end
end
To activate the snippet, call CreateOverwatch before MonitorOverwatch.
Last edited: