• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Do all groups leak

Status
Not open for further replies.
Level 4
Joined
Jul 30, 2007
Messages
79
i am making a TD and i have just learned about memory leaks

i know in general group functions leak but my question is

i am spawning creeps and adding them to different group variables
these group variables are used for the pathing when entering regions

these same group variables are reused each round on the new creeps

now i am never destroying the groups so i feel like they are leaking
will using
Custom Script: call DestroyGroup(udg_UnitGroup)

for each of the group variables at the end of the round fix these leaks that i think i am creating
or is there some other way i should go about this
 
Level 4
Joined
Jul 30, 2007
Messages
79
ok so im sure that answered my question but this is greek to me atm so
here is my trigger


  • Events
    • Time - MoveTimer[1] expires
  • Conditions
    • Spawned[1] Less than SpawnCount[1]
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Difficulty Equal to 0
    • Then - Actions
      • Set TempPoint1 = (Center of Spawn1 <gen>)
      • Unit - Create 1 UnitLevel[Level] for Player 12 (Brown) at TempPoint1 facing 90.00 degrees
      • Unit Group - Add (Last created unit) to Group1
      • Special Effect - Create a special effect at TempPoint1 using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
      • Set Effect[1] = (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Wait 0.50 seconds
      • Special Effect - Destroy Effect[1]
      • Set Spawned[1] = (Spawned[1] + 1)
      • Set TempPoint1 = (Center of Spawn8 <gen>)
      • Unit - Create 1 UnitLevel[Level] for Player 12 (Brown) at TempPoint1 facing 90.00 degrees
      • Unit Group - Add (Last created unit) to Group8
      • Special Effect - Create a special effect at TempPoint1 using Abilities\Spells\Items\AIre\AIreTarget.mdl
      • Set Effect[2] = (Last created special effect)
      • Custom script: call RemoveLocation(udg_TempPoint1)
      • Wait 0.50 seconds
      • Special Effect - Destroy Effect[2]
      • Set Spawned[1] = (Spawned[1] + 1)
    • Else - Actions
      • Do nothing
    • Countdown Timer - Start MoveTimer[1] as a One-shot timer that will expire in 0.50 seconds

are there any leaks in this?
if so where are they and why ( the more i learn the less i ask )

i have read the leak threads but they just go right over my head for the most part
i appreciate the help in trying to teach this slow learner
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
As long as you do not overwrite a group variable with a different group it will not leak (global variables only). You can add and remove units from the group with out it leaking and you can use that group in functions as much as you want with out it leaking. But if you want to put a new group in that vaiable, then and only then do you have to destroy the group before puting the new group in the vairable.

Only unit and player groups leak, destructables do not since they are not a group but a direct function.
 
Status
Not open for further replies.
Top