| 06-28-2004, 12:24 PM | #31 |
Erhm, Yes, they both leak too. And you just use the exact same methods to take care of those leaks as I explained in the first post. Catch it into a temp variable. Use it, Destroy it. ~Cubasis |
| 06-28-2004, 02:54 PM | #32 |
wow... if we still had points then a great thing to get like a million points would be to go through and fix everyones memory leaks. P.S. check out the new subject icons o_O |
| 06-29-2004, 02:42 PM | #33 |
Nice tutorial man, thanks for taking the time to write it! |
| 07-05-2004, 07:42 AM | #34 |
If i explode a unit, do i need to remove it still? I am using something along the line of a unit enters region explode sorceress. |
| 07-05-2004, 03:13 PM | #35 |
I heard that ExplodeUnit clears it out of memory, so it causes no memory leak. However, I have never tested or even used this function, so I can't really confirm that. ~Cubasis |
| 07-08-2004, 03:21 AM | #36 |
Would this cause memory leakage? I have a trigger-enhanced spell that's set up so that when unit summons Dark Rider of War, it centers the rect called Riders on the summoned Dark Rider of War then 'summons' 3 more dark riders (Death, Plague, Famine) at polar offsets to the center of the rect (where the Dark Rider of War stands) |
| 07-09-2004, 08:53 PM | #37 |
Does this cause memory leaks? Pick every unit in Pathing[1] and issue order to "PICKED UNIT" to attack-move to TeamCastle[2] Custom Script: call DestroyGroup( udg_Pathing[1] ) Custom Script: call RemoveRect( udg_TeamCastle[2] ) Im having a feeling "picked unit" does....... |
| 07-10-2004, 01:14 AM | #38 |
@ChaosWolfs: actually no leak there. you actually shouldnt have destroyed those points because theyre globals and you may need them later. @mutevampire: yes.. the origin point leaks, and then the final point. so you need to use a var for the origin and then instead of making the units at the polar offset you need to set the point to a variable and then create the units at the var. and finaly.. @someone smarter than me: eh... were both of those answers right? |
| 07-13-2004, 12:25 PM | #39 | ||
Twistar, that's pretty much correct. Although, Chaoswolf seems to be working with a "Rect" (TeamCastle[2]), and he can't order units to actually move to those, he has to get the center of it (a location) for that action to work, and that's a location he needs to deal with propperly. And yes, you don't really need to remove the rect if it's a global. And mutevampire, i'll just quote myself: Quote:
and now i'll quote you: Quote:
So, as (Polar Offsets) AND (Center of Rect) are both actions inside the Point window. They will both leak.... except if you grab them into a variable and destroy them afterwards. I thought I had made it very clear in the article. ~Cubasis |
| 07-20-2004, 11:36 AM | #40 |
If i have several spawn triggers that trigger at the exact same time, and i do this: - Set TempRect = SpawnAllies1 - Remove TempRect If i do this in another triger at exactly the same time, will it make a difference? If so can i use arrays to change it? When setting the variable and removing it with custom script, does the variable name have to be say temppoint, or TempRect, or TempGRoup (or whatevers written there) ? Thanks in advance :) |
| 07-20-2004, 01:28 PM | #41 |
Firstly, I don't really understand completely what you're doing and stuff. But... Triggers can not run at the exact same time. That is, if they do, one trigger will run completely (or up to a Wait action), then the next will run etc. And lol, the variable name can be ANYTHING ;P, I just chose Temp<type> as a example name. If you create a variable in the editor, it's "real" name (in jass) is: udg_<ChosenName> If you want to remove a location in a array, you do this: call RemoveLocation( udg_MyLocArray[0] ) Replacing whatever index you want. ~Cubasis |
| 07-20-2004, 11:25 PM | #42 |
yes it will. If you have trigger that use the same variable at the same time, they'll overact. Use arrays instead, e.g. YourVar[1] = Center of bla. No the variable can have any name. |
| 07-21-2004, 07:49 AM | #43 |
Thanks, that helps :D |
| 01-08-2005, 12:48 AM | #44 |
(Warning! note that i've never ever used jass except the simple : call removeLocation) First off : why can't you just use something like: Custom script: call removeLocation( (GetUnitLoc(GetAttackedUnitBJ())) ) why does it have to be a variable? Second: Code:
Chidori Power
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Chidori (Lightning Edge) (Lightning) C
Actions
Unit - Order (Attacking unit) to damage (Attacked unit) for ((Life of (Attacked unit)) / 10.00) using attack type Chaos and damage type Lightning.
Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
Unit - Move (Attacked unit) instantly to ((Position of (Attacked unit)) offset by 10.00 towards (Angle from (Position of (Attacked unit)) to (Position of (Attacking unit))) degrees)I know this leaks, but how does it work? shall i just take away the Locations AFTER the last action? or after every action that has a leak in it? Couse i need the locations in all actions. hmm i can take another example: This would be a triggered (with GUI) spell Code:
Event : unit casts an ability
Cond: ability being cast = ExampleAbility
Actions:
-Set TempLocation[playernumber of owner of casting unit] = bla bla bla
-For each (Integer A) from 1 to 2, do (Actions)
Loop - Actions
Unit - Create 1 Footman for Player 1 (Red) at (TempLocation[playernumber ...]) facing Default building facing (270.0) degrees
Wait 2 seconds
Custom Script: Call Remove( udg_TempLocation[playernum...] )If i would do like this, there would not be any temploc[blablabla] at the seconds time in the loop, and if i put the "Set TempLocation = bla bla bla" in the loop, it would change if the unit would move and it would be kinda messy if you want the units to stand at a specific place from the Caster. Anyway, how do you think i should do to make the "Chidori Power" trigger non-leaky? thx on advance (Edit:) Third: Custom script: Call RemoveLocation( udg_WaterCannonTempPoint ) i get the error message expected a code statement what have i missed? |
| 01-27-2005, 01:56 PM | #45 | |||||
Ok, even though this is a old topic, it can use a small kick to help new guys with leaks? I just tghout i would answer these questions: Quote:
Well, the answer is quite simple, When you call GetUnitLoc(GetAttackedUnitBJ()) it creates a location in the memory without a handle you can all again. So when its called the first time, in ie a loop, it creates a Location, and when you call: call removeLocation( (GetUnitLoc(GetAttackedUnitBJ())) ) it creates the location, and then instantly removes it. its kinda useless this way ;) Quote:
Yes, well, iam not quite sure, but it doesnt really matter when you remove the variables from the memory.. ie, if you remove then after they are used its the same if you remove them at the end of the trigger. So you could do it like this: Code:
Chidori Power
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacking unit)) Equal to Chidori (Lightning Edge) (Lightning) C
Actions
Unit - Order (Attacking unit) to damage (Attacked unit) for ((Life of (Attacked unit)) / 10.00) using attack type Chaos and damage type Lightning.
Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
Set Variable - temp_chidori_attacked = (Position of (Attacked unit)
Set Variable - temp_chidori_attacking = (Position of (Attacking unit)
Unit - Move (Attacked unit) instantly to (temp_chidori_attacked) offset by 10.00 towards (temp_chidori_attacked) to (temp_chidori_attacking) degrees)
--- Comment - Clean up all leaks ---
Remove Location - temp_chidori_attacked
Remove Location - temp_chidori_attackingBut it would look like this: Quote:
But this would solve leaking. Quote:
This is quite simple, you can place the remove location just after the loop? it doesnt have to be inside the loop, just remove it afterwards! Quote:
|
