• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

JASS Question

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
I know in JASS that you must set local handle variables to null or they will leak. It ends up looking like this:

JASS:
function doStuff takes nothing returns nothing
    local unit u = GetTriggerUnit()
    set u = null
endfunction

However, in a first of group loop, the unit variable you use eventually gets set to null, anyway, right? Do I need to do a set u = null after the loop or is it good to go? I'm inclined to believe I am good to go, but you never know with JASS lol.[/icode]
 
Level 12
Joined
May 22, 2015
Messages
1,051
Yes in FoG tequniche it's premise that the variable is null when you call FirstOfGroup function and there is no unit left, to get it even work.

So you do not have to null it after the loop to prevent leaks.:)

Btw, you only need to null agents, not all handles.
That was lightning fast! Thanks for the reply.

Is there somewhere I can see which are agents and which are handles? I think I just nulled everything that is not a primitive variable lol
 
Status
Not open for further replies.
Top