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

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

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
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.
 
Level 7
Joined
Jan 30, 2011
Messages
267
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)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
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.
Top