i've tested it before for a random map generator i was working on, i made a trigger that created a few thousand locations per second, when i left the trigger leaking the game usually became very laggy and crashed a couple minutes into it, after modifying the trigger to simply set tempLoc to a random point i've managed to keep the trigger running for a couple hours before i got bored. i've stopped removing variables ever since and haven't had any problem, so i guess it doesn't leak. is there something else i'm missing?
It does leak, all your doing is overwriting the data stored inside the variable, however the location is not removed and therefore still in memory!
If you have recently bought a better computer with more RAM memory or have changed your RAM memory then it means that your computer can handle more memory leaks.
And b.t.w. your not removing the variable but your removing the location. Removing the variable would mean nullifying the variable as such: set udg_My_var = null
Which means the variable still exists but does not take any memory since it's completely empty.
The most optimized way of removing a location leak would be setting a variable to the location, using that variable,
removing the location and afterwards nullifying that variable.
Although I doubt that 1 more stored variable inside your memory won't make any difference...
A few tips on optimizing your map:
Add expiration timers to killed units to decrease the decaying timer of units to reduce the amount of units in your map.
Nullify variables if they are not used in your game anymore.
Note:
When using local handle variables in JASS, they cause a small leak. A handle is everything except real, string, integer, and boolean. If I'm not mistaken, this only occurs if the handle is ever destroyed or removed from the game. This means that if you are certain a handle will never cease to exist, it's safe not to null the variable. Althought players are handles, they should never need to be nulled.
JASS:
local unit u = GetTriggerUnit()
call SetUnitFacing(u, 270)
call SetUnitFlyHeight(u, 300, 50)
set u = null
Explanation of local variables: local variables are basically used to make triggers Multi User Instanceable.
Meaning that the trigger can be triggered simultaneously without causing the player who trigger it to de-synchronize with the data that is being send from the server to the client. Server in this case would be the game and client your computer.
When this happens the player does not receive the actual game data from the game causing the player to see stuff that is not actually there, or not see stuff that actually is there.
This usually causes the player to disconnect from the game.
So using local variables mean that multiple users can trigger the trigger at the same time since they are not using the same global variables at the same time, but local ones for each player.
Mostly of the time local variables are used in triggered spells and such.
However there are also ways of showing data to a player locally without causing a desync (however this depends on where you are using it for). For example:
JASS:
if (GetLocalPlayer() == player(0)) then
Do something here for player 1 locally
endif
GetLocalPlayer() is one of the most usefull natives out there...
Destroy Triggers when they are not being used anymore.
Note:
Only do this when you're sure you're not going to use them anymore: call DestroyTrigger(GetTriggeringTrigger())
Destroy Player Groups when they are not being used anymore.
Destroy Sounds when used.
Destroy Special Effects when used.
Destroy Unit Groups when they are not being used anymore.
Take reference here:
http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/complete-list-things-leak-126761/
Adding an expiration timer or removing killed units is not a leak but is considered to optimize your map since it decreases the amount of units in game.
With random point what exactly do you mean? Coordinates do not leak, for example: UnitX, UnitY
I hope this helps in improving the performance and speed of your map
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
!
I also hope this post has learned you something new ^.^...