In a situation where a trigger is handling the same unit multiple times, you can set it as a variable like 'unit 1' and then use that variable instead of referring to "Unit 0012 <gen>" over and over. I'm not talking about a triggering unit, but a unit that has been pre-placed in the map. If you refer to it as "Hero 0012 <gen>" will that cause a leak or slow anything down, or does it even make a difference? Leak checker says it doesn't create a leak but I'm not sure it's telling the truth.

WatermelonMan wrote:... you can set it as a variable like 'unit 1' and then use that variable instead of referring to "Unit 0012 <gen>" over and over.

"Unit 0012 <gen>" is just a global variable created by the editor.I would however suggest to use a udg, because if you ever want to change that unit, it'll be way easier with a udg and might save you a lot of clicking.

You're getting two different things mixed up. A handle will leak when you lose reference to it without destroying it and it's no longer needed (e.g. a location). This is because there is no garbage collection in JASS. A handle variable will leak when it loses scope and it's not pointing to null. This is because JASS is fucking retarded.

Since global variables never lose scope, the second type of leak is impossible in the scenario you suggest. Only a global variable can be accessed by two different functions. Even two instances of the same function cannot access the same local variable as they both create their own copy.

In trigger 1, if a unit casts an ability and I use variable x to mark that units position when it casted, and then I use a different trigger, trigger 2, to detect if the unit comes within range of variable x, and if it does, then trigger 2 kills the unit and removes variable x then does that creates a leak? I have to remove the location in the trigger that it is created in? But if variable x were a unit then that does not create a leak?

That variable is global. You only need to destroy the location (i.e. RemoveLocation) once you no longer need it and before you use the variable for another location. For temporary dummy casters, I recommend giving them a timed life of a few seconds so they disappear on their own.

Unit groups will leak. A group is created to hold all of the units that you want to loop through. Just like locations, the group will stay in memory until you destroy it, and if you lose reference to it it will just take up space and be useless.

I never see anyone use blizzard's global that they have for this, but you should be able to put the line

meh, that's like telling a high school student in art 1 that they shouldn't use water colors if they want their paintings to look realistic. JASS would be more efficient, it just wouldn't be efficient for me to learn JASS.

WatermelonMan wrote:meh, that's like telling a high school student in art 1 that they shouldn't use water colors if they want their paintings to look realistic. JASS would be more efficient, it just wouldn't be efficient for me to learn JASS.

Kaz wrote:Which is of course something based on absolutely nothing except misconceptions that you told yourself. People use vJass nowadays and it's extremely simple and efficient

No, I'm saying that there is no point for me to learn JASS because I already know GUI and I don't plan on going any further than my stupid map, I don't want to be programmer, I don't want to make games, I don't want to do anything associated with any of the above I'm just doing it because it's a source of amusement.