• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to fix timer leak

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
  • Init UI
    • Events
    • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
    • Loop - Actions
    • Camera - Set (Picked player)'s camera Height Offset to 1000.00 over 1.00 seconds
    • Trigger - Turn off Germany Extra Income <gen>
    • Trigger - Turn off Lend Lease Income <gen>
    • Trigger - Turn off Units Soviet Buildup <gen>
    • Trigger - Turn off Cold War Fighting <gen>
    • Trigger - Turn off Cold War Forced Enemy <gen>
    • Trigger - Turn off Western <gen>
    • Trigger - Turn off Greece Extra Income <gen>
    • Countdown Timer - Create a timer window for Turn with title Iconome in :
    • Set Turn_TimerWindow = (Last created timer window)
    • Countdown Timer - Start Turn as a Repeating timer that will expire in 60.00 seconds
Leak tester says that theres leak
type of leak Type: timer
CreateTimer [Blizzard.j:605] please help! i dont know how to remove that leak.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
To be honest I cannot see any timer leak at all. I ran through the JASS pretty much line by line and none of it creates any timers and the timer which is used is created at map initialization as part of the global initialization and must never be destroyed. I am guessing the leak checker tool has a bug in it or something?
 
Level 22
Joined
Feb 6, 2014
Messages
2,466
@emil23
You don't leak a Player Group because 'All Players' does not leak. Your timer is created at map initialization (not dynamically) so only 1 timer is created. Since you're dealing with GUI, it's best not to destroy this timer so you can re-use it. Note that tere is no GUI action that allows you to create a timer dynamically (except Custom scripts).
However, you're creatimg a timer window every second
I would not say the shown trigger leaked either, but if I were to guess why the tool said it was leaking..
If the leak checker thinks his trigger leaks a timer, then it is a bad leak checker.
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
However, you're creating a timer window every second.
No he creates only one ever...
  • Time - Elapsed game time is 1.00 seconds
This trigger should only ever fire once. I can also assure you that it does not create the timer dialog in the loop (that part did not copy well).

If the leak checker thinks his trigger leaks a timer, then it is a bad leak checker.
Probably is. It also failed to pick up many other leaks.
 
Level 14
Joined
Aug 30, 2004
Messages
909
This might be a bit controversial...but if a trigger fires only once without any repeated code... why would anyone care if it leaks a bit? All of Blizzard's maps leaked and the campaign runs just fine.

I know experts like to be precise and thorough, but this poor map maker has been wasting a lot of time hunting down a leak that probably doesn't exist, and even if it did would be completely unnoticeable to anyone playing his map.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Is it even a leak?
  • Countdown Timer - Start Turn as a Repeating timer that will expire in 60.00 seconds
I think this will create a timer object for the variable Turn. Then it will use that internally. In this sense, it HAS to "leak" in order to keep the periodic (Repeating) timer. I can't be certain since I'm not 100% sure what this function translates to in JASS, but that is my guess.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
I think this will create a timer object for the variable Turn. Then it will use that internally. In this sense, it HAS to "leak" in order to keep the periodic (Repeating) timer. I can't be certain since I'm not 100% sure what this function translates to in JASS, but that is my guess.
It translates into a call of the following.
JASS:
function StartTimerBJ takes timer t,boolean periodic,real timeout returns timer
    set bj_lastStartedTimer = t
    call TimerStart(t, timeout, periodic, null)
    return bj_lastStartedTimer
endfunction
So as you can see, no leak.
 
Status
Not open for further replies.
Top