Jesus4Lyf
Good Idea™
- Reaction score
- 397
These are memory leaks (but not handle id leaks). You must check the process list to see it leak.
Credits to Troll-Brain for finding the original leak.
This leaks:
In fact, even this leaks:
This does not leak:
What's the exact cause? Discuss. I will update this post as conclusions are reached and verified.
This is a minor leak.
Conclusion:
Not allowing a handle id to be recycled immediately after destruction causes a memory leak.
Credits to Troll-Brain for finding the original leak.
This leaks:
JASS:
library Test initializer init
globals
private group G1
private group G2
private group GROUP=CreateGroup()
private trigger Trig
endglobals
private function Actions takes nothing returns nothing
call BJDebugMsg("Start")
call EnableTrigger(Trig)
call TriggerSleepAction(10.)
call DisableTrigger(Trig)
call BJDebugMsg("End")
endfunction
private function DoTheTest takes nothing returns nothing
//call BJDebugMsg("run")
set G1=null // With or without this line.
set G1=CreateGroup()
call DestroyGroup(G1)
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
set Trig = CreateTrigger()
call TriggerRegisterTimerEvent(Trig,0.0,true)
call TriggerAddAction(Trig,function DoTheTest)
call DisableTrigger(Trig)
call TriggerRegisterPlayerEventEndCinematic(trig,Player(0))
call TriggerAddAction(trig, function Actions)
endfunction
endlibrary
JASS:
library Test initializer init
globals
private group G1
private group G2
private group GROUP=CreateGroup()
private trigger Trig
endglobals
private function Actions takes nothing returns nothing
call BJDebugMsg("Start")
call EnableTrigger(Trig)
call TriggerSleepAction(10.)
call DisableTrigger(Trig)
call BJDebugMsg("End")
endfunction
globals
boolean k=false
endglobals
private function DoTheTest takes nothing returns nothing
//call BJDebugMsg("run")
if k then
set G1=null
else
set G1=CreateGroup()
call DestroyGroup(G1)
endif
set k = not k
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
set Trig = CreateTrigger()
call TriggerRegisterTimerEvent(Trig,0.01,true)
call TriggerAddAction(Trig,function DoTheTest)
call DisableTrigger(Trig)
call TriggerRegisterPlayerEventEndCinematic(trig,Player(0))
call TriggerAddAction(trig, function Actions)
endfunction
endlibrary
JASS:
library Test initializer init
globals
private group G1
private group G2
private group GROUP=CreateGroup()
private trigger Trig
endglobals
private function Actions takes nothing returns nothing
call BJDebugMsg("Start")
call EnableTrigger(Trig)
call TriggerSleepAction(10.)
call DisableTrigger(Trig)
call BJDebugMsg("End")
endfunction
private function DoTheTest takes nothing returns nothing
//call BJDebugMsg("run")
set G1=CreateGroup()
call DestroyGroup(G1)
set G1=null
endfunction
private function init takes nothing returns nothing
local trigger trig = CreateTrigger()
set Trig = CreateTrigger()
call TriggerRegisterTimerEvent(Trig,0.0,true)
call TriggerAddAction(Trig,function DoTheTest)
call DisableTrigger(Trig)
call TriggerRegisterPlayerEventEndCinematic(trig,Player(0))
call TriggerAddAction(trig, function Actions)
endfunction
endlibrary
This is a minor leak.
Conclusion:
Not allowing a handle id to be recycled immediately after destruction causes a memory leak.