Saturday, April 14, 2012

Quick Leak Question

[:1]Hi all, I have a question about memory leaks. Do conditional integer comparisons verifying the number of units in a group leak? For example in...

Legion Doctrine Death

Events

Unit - A unit Dies

Conditions

(Number of units in (Units owned by (Owner of (Dying unit)) of type Legion Doctrine DummyUnit)) Greater than or equal to 1

Actions

Set RandomNumber = (Random integer number between 1 and 100)

Set TempGroup1 = (Units owned by (Owner of (Dying unit)) of type Legion Doctrine DummyUnit)

Set TempPoint1 = ((Owner of (Dying unit)) start location)

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

RandomNumber Less than or equal to (45 + (5 x (Level of Legion Doc Buff for (Random unit from TempGroup1))))

Then - Actions

Special Effect - Create a special effect attached to the origin of (Dying unit) using Abilities\Spells\Items\AIil\AIilTarget.mdl

Set temp_effect = (Last created special effect)

Trigger - Run Destroy Special Effect <gen> (ignoring conditions)

Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at TempPoint1 facing Default building facing degrees

Else - Actions

Custom script: call DestroyGroup (udg_TempGroup1)

Custom script: call RemoveLocation (udg_TempPoint1)

Does the first condition, ((Number of units in (Units owned by (Owner of (Dying unit)) of type Legion Doctrine DummyUnit)) Greater than or equal to 1), leak? I have a suspicion that it does considering it is not a variable and is not destroyed, but I dont think it can be, considering it is in the "Conditions" section and not the "Actions" section of the Trigger Editor...

Thanks and any feedback is much appreciated|||Briefly, no.

Leaks (so called) occur when GUI performs an actions and creates a new actual object inside the game that is not being removed.

Checking an object/point/number/statement does not create a new one, therefor not causing it to "leak".|||Thanks! I had been wondering about that for a while.|||Actually, that does leak. You're creating a unit group that you're not destroying.

Conditions can leak just like actions can. That condition calls GetUnitsOfPlayerAndTypeId, a function that creates a unit group.|||Leaks (so called) occur when GUI performs an actions and creates a new actual object inside the game that is not being removed.

Checking an object/point/number/statement does not create a new one, therefor not causing it to "leak".



__________________

Christian Louboutin

Replica Watches

Replica Handbags

No comments:

Post a Comment