• 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.

[Trigger] About leak.

Status
Not open for further replies.
Level 22
Joined
Sep 24, 2005
Messages
4,821
Before setting it to null, otherwise your removing a null location and leaking an object.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
You can remove leaks if you're not using it in some stuffs. Like

Set Leaks = Position of Unit
CreateUnit ( Footman, Player Red, Leaks, 0 )
blabla.......
call RemoveLocation ( udg_Leaks )

You will remove it when you don't needed it anymore.
 
I already know how to deal with leaks but.... we use the
Custom script: call RemoveLocation(udg_templocation) at the end of trigger or behind the set variable

Only use it after all actions where you need this udg_templocation.
Or in case after some actions you wanna set udg_templocation to a new location, then also use it.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Depends, if you're going to use global variable, the one on GUI, you don't need to null them, but you still need to destroy the said objects your triggers create.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Nulling is done do reduce the handlecount and allow the game to reuse the same memory space. With globals variables it is mostly pointless, because they already have a predetermined memory space, so they can be overwritten without problems(except handles).
The problems with handles(such as locations) is that the variables don't really contain the values. Instead they point to the value somewhere else in memory. Due to this, nulling or overwriting a location doesn't really help, as the actual value will still be somewhere in memory.

OT: Remove the location after you have finished using it. This pretty much equals to saying that "Alright game, I don't need this location anymore. Clear it up, okay?"
 
Status
Not open for further replies.
Top