This is a short tutorial which covers the most basic "leaks" you might make when triggering. A leak is essentially a piece of useless memory. Imagine that you were making a triggered spell which spawned a "dummy" unit on a target point, and had the dummy cast War Stomp. The trigger would look like Spoiler: this This ability would work alright, but it creates several leaks. When the ability has been used there is still untapped memory, which will clutter your map and make it slower, and slower, and slower. First of all, the dummy unit will stand around on the map forever after having used its warstomp. It needs to be removed. For this purpose we use an expiration timer (like the one from summoned units), usually 1 second or less will suffice. Secondly, the unit is created at "Target Point of ability being cast" meaning that the world editor creates a point, places a unit there, and then the point remains in the memory. It is unnamed, and cannot be called or "found", but it is still filling up the map. The point must be saved in a variable, and then destroyed after the unit is spawned. Spoiler: If you don't know how to create variables Use this icon in the trigger editor to open the variable editor. Click New Variable, and a window will pop up. The new variable can be called whatever you like (though you cannot use spaces, use underscores _ instead) There are several variable types such as unit, point, unit group, special effect, timer, and so on. Right now we need a point. Array and Initial Value will not be necessary for this tutorial. A leak-free trigger will look like Spoiler: this Note the custom script at the end. This is what destroys the Point variable (destroys as in: empties the memory). When doing custom scripts take note of where spaces and capitalizations are, "remove location" does not work, but "RemoveLocation" does. The "udg_" in front of the variable name is also important. (Sorry about mispelling "temporary" here, but actually as long as the custom script and variable name matches, it makes no difference) You might also create a leak when selecting units. Let's say you wanted to select units around the target point, and deal some damage to them, without a dummy. Again you must first set a Unit Group variable, and then destroy it afterwards. Or use the second method, seen below. Spoiler: Avoiding Unit Group Leaks Note how we also manage the point variable here, and avoid a leak when creating the group. The third picture, the one with "also good" is another way. When putting the custom script "set bj_wantDestroyGroup = true" right before a group action, the leak will automatically be removed IMMEDIATELY after the group action. Both scripts can be used, but if you wish make multiple references to a group, you'll want to save it in a variable, and remove it later. NOTE: As a rule of thumb, it is a good idea to declare units in variables. For the trigger with the dummy unit, it would be a good idea to set "Temporary_unit = last created unit", and in the following actions replace (Last Created Unit) with "Temporary_unit" instead. I'm not a programmer or nothing, so I can't explain why, but it does help efficiency. Think of it as the difference between "calculate 2+2, calculate 2+2, calculate again..." and "set Name=2+2, reference Name, reference Name..." the processor doesn't make the calculation over and over again. EDIT: On the advice of Krystalknoct I have updated the tutorial to include the scripts and/or GUI actions for dealing with other common leaks. I'll make a short list, as I have already explained what leaks are and all... Spoiler: Leaks and fixes: As I have already covered locations and group variables, let us proceed with the rest... 1. Floating Text Floating text is... floating text. A line of text/numbers that appears at a location or over a unit. Note that when placing floating text at a point, rather than above a unit, you will have to deal with a point variable as well. There are two ways to deal with floating text, the latter being the most useful in my opinion: Spoiler: Various methods; Floating text: Changing the lifespan of a floating text will work much like an expiration timer for units - but you need to disabled permance first, else nothing happens. 2. Player Groups Player groups are much like unit groups; they have no real in-game effect, but is the editor's way of handling multiple players and for looping through these. In the trigger below, all players who are playing (meaning no closed slots) have the "Animate Dead" ability disabled for them. The player group variable is then removed. Spoiler: PlayerGroup LeakCleaning 3. Special Effects Admittedly, this should have been in here to begin with. Special effects are some of the most used things in custom triggered spells, and cleaning the leaks is very important. Special effects are... special effects. Things like the thunderclap crackle, the flamestrike explosion, Holy Light's... light. NOTE: Like floating text, Special effects can be attached to units or simply created at set points. Be mindful of the difference, as the latter requires a point variable and leak cleaning. Dealing with special effects in GUI is easy: Spoiler: Special Effects Anti-Leak This displays a Thunderclap special effect at the center of the map at map start. Then removes leaks. Simple enough, right? NOTE: While special effects will mostly get to display before they are destroyed, it is not always so! Sometimes they're destroyed so fast, that nothing is seen. In this case, it is actually better to use a dummy unit - having the model changed to the appropriate effect. Truly, using dummy units instead of effects (and then adding a short expiration timer) is actually easier on the processor than using special effects, but this requires making a dummy for every effect you wish to use. Spoiler: Alternate fool-safe method Just remember to make the dummy untargetable, invulnerable, and without a shadow. 4. Sound Like special effects, sounds can mostly be destroyed right after playing, and people will still get to hear them. 5. Lightning Like with floating text, you would probably want to save your "last created lightning effect" in an appropriate variable, and destroy it after a while. And finally; everything else. Remember to remove stuff like items, created weather effects, units, destructibles, and so on. There are simply GUI actions for all - as a rule of thumb, if there's a "Destroy XXX" or "Remove YYY" action, you want to use that.