Event Leak

Ayanami

칼리
Reaction score
288
Not sure if this thread belongs in this section. Just wanted to know how an event leak actually occurs.
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
1. You add an event to a trigger.
2. The event loses relevance (eg. if it's a unit event, and the unit gets removed from the game.)
3. You don't do anything else, and now there's a useless event attached to a trigger taking up memory.

To combat this, use dynamic triggers; supposedly, destroying a trigger destroys its events and conditions, but not its actions. (I'm just going by what I've read that others have reported, and how many systems are coded.)
 

Ayanami

칼리
Reaction score
288
1. You add an event to a trigger.
2. The event loses relevance (eg. if it's a unit event, and the unit gets removed from the game.)
3. You don't do anything else, and now there's a useless event attached to a trigger taking up memory.

To combat this, use dynamic triggers; supposedly, destroying a trigger destroys its events and conditions, but not its actions. (I'm just going by what I've read that others have reported, and how many systems are coded.)

So, destroying the trigger will destroy everything except the actions? Wouldn't that cause a leak too?
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Yep, unless you use conditions. Or if you save your actions and use TriggerRemoveAction() before destroying your trigger.
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
"supposedly, destroying a trigger destroys its events and conditions, but not its actions"
Ok that can't be true...it just doesn't make sense(to me at least), some crazy destructor triggers must have this to be true.

>So, destroying the trigger will destroy everything except the actions?
No that won't do much the magic thingy is:

local handle h = CreateHandle()
DestroyHandle(h)
h = null // why nulling? -> dunno =)


Edit:
>Yep, unless you use conditions.
Conditions also leak. But a lot less I guess...go figure.
 

chobibo

Level 1 Crypt Lord
Reaction score
48
No that won't do much the magic thingy is:

local handle h = CreateHandle()
DestroyHandle(h)
h = null // why nulling? -> dunno =)
No, that only dereferences a reference. Handles are references, unlike the basic data types which copy data when set to another variable, references just point to an object in memory, warcraft's scripting engine doesn't automatically dereference local handle type variables, which causes reference leaks, thus the need to null dynamically allocated handle types.
 
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