Quick question about memory leaks

ThePlague

New Member
Reaction score
14
set udg_tempunit= GetTriggerUnit()

since this is a global and will be overwritten constantly is there any need to nullify this?

also since it is only temporary to avoid leaking with GetTriggerUnit()
does it make any difference if i use
set udg_tempunit= GetTriggerUnit()
or
local unit temp= GetTriggerUnit()

Edit: this is just for simple triggers with few actions and no waits
 

Artificial

Without Intelligence
Reaction score
326
> since this is a global and will be overwritten constantly is there any need to nullify this?
Nope, there isn't any need to null globals.

> avoid leaking with GetTriggerUnit()
GetTriggerUnit doesn't leak...

> does it make any difference if i use [...]
You need to null locals, but there's not much of other difference in there.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
> set udg_tempunit= GetTriggerUnit()

No leak here, no other action needed.

> local unit temp= GetTriggerUnit()

One extra action needed: set temp = null when done.
 

ThePlague

New Member
Reaction score
14
really? I thought all of the generic variables triggering unit, casting unit, etc leaked.

Is this only true for triggering UNit or are tehre others that do not leak?


New question also is there any advantage to using condition and action functions seperately? or can i just use:

if condition then
actions
endif
(with no other actions so nothing would happen)

or

if opposite condition then
return
endif
actions
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top