| 05-08-2005, 04:30 PM | #1 |
After having read a bunch of posts regarding leaks, I still couldn't figure out if this would cause a leak and how to prevent that leak; Set TempUnit = Target unit of ability being cast Order TempUnit to MoveTo (...) If so, the answer would be to destroy the contents of the variable at the end of the trigger, that much I get, but how would I go about doing that without killing the unit in the process? |
| 05-08-2005, 06:05 PM | #2 |
set TempUnit = null but this isn't a big deal, this is just removing the link address, theres no new object created by your triggers (ie it doesn't create a new temporary unit, it just links the variable to the existing unit) though, the (...) you have there could potentially leak, as if you chose some kind of 'center of region' or 'position of unit' in there its going to create a new temporary point that will leak |
| 05-08-2005, 06:06 PM | #3 |
If you have the editor UMSWE, it provides you with a few extra triggers that delete variables and other things that cause leaks. So after you have ordered the unit, try using a wait command for like 3 seconds then use the trigger to destroy the variable. If this doesn't work or sounds stupid, sorry for wasting your time. ~Azhag~ EDIT: Ahhh listen to Raptor-- not me. :P |
| 05-08-2005, 06:12 PM | #4 |
Thx, that clears things up |
| 05-08-2005, 07:21 PM | #5 |
Yes, as Raptor-- said, the unit isn't a leak problem. The unit is there before this trigger runs and will be there afterwards. The problem are other objects, the ones that are created within your trigger, such as point objects (a point object is created whenever you use a "center of region", "position of unit", or any other similar function), unit group objects ("units in region", "units within range",...), special effects and others (which are used more rarely and are therefore mostly not a problem, like player groups). The idea of seting these objects to a variable before using them is that we then have a pointer (the variable) that points to this newly created object, so we can then destroy it later with the according function (like RemoveLocation() for points and DestroyGroup() for unit groups). |
