• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Will a location leak if it's only stored in a variable?

Status
Not open for further replies.
Well it techniquelly hasn't leaked, because the warcraft engine can still remeber "loc1" and hence remove it.

You would also need to remove "loc1" after it has been used to clear up some memory.

  • Custom script: call RemoveLocation (udg_loc1)
Clearing the variable "loc2" shouldn't affect the "loc1" variable.
 
if he does RemoveLocation(udg_loc2) then he doesnt need to do RemoveLocation(udg_loc1)
loc1 and loc2 are no locations, they just point at a location handle, and that handle has to be removed, so its doesnt matter if u do RemoveLocation(udg_loc2) or RemoveLocation(udg_loc1)
beside that u could null the variables, but that leak is not too bad, cause they are global variables (so they would leak only 1 time if u dont null them)
 
locations are objects. They are referenced via handle which is what the variables store. If you remove a location then the handle that pointed to it is no longer valid.

1. set loc1 = some location
2. set loc2 = loc1
3. use loc2
4. clear loc2 with custom script
Both loc1 and loc2 have the handle value of "some location". "some location" has been removed and all resources used by it have been given back to the game to free to the system or be recycled for new objects.

To allow the handle value that was used for "some location" to be recycled you will need to set both loc1 and loc2 to a different location handle such as null or a new/existing location.
 
Status
Not open for further replies.
Back
Top