• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Memory Leak Question: How is "Pick Every Unit in Unit Group and Do Actions" Run?

Status
Not open for further replies.
Level 3
Joined
Aug 29, 2006
Messages
55
I'm going through my map and cleaning up memory leaks. I just got to a situation where I am "picking every unit in unit group and doing stuff". Inside the "do stuff" area, I am making a point, using it and then removing it. I normally do this inside a For loop, but here the unit group can be of variable size. I think it should work the same, and not leak, but I wanted to double check.

The question is how "pick every unit in unit group and do stuff" gets parsed. Does it go through each unit in the unit group one and a time and "do the stuff" (kind of like a For loop)? If so, then I think this shouldn't leak, ya?

The thing that I'm worried about is the "TempPoint_FrogVisibility" inside the "Pick Every Unit..." area. Since that happens a bunch of times, I want to make sure it's getting cleaned each time before a new instance of it is started.

Here is my trigger:

  • Frog Visibility
    • Events
    • Conditions
    • Actions
      • Set TempPoint_Silis = (Position of Silis)
      • -------- Point Value of 1 means critter --------
      • Set TempGroup_FrogVisibility = (Units within 2000.00 of TempPoint_Silis matching ((Point-value of (Matching unit)) Equal to 1))
      • Unit Group - Pick every unit in TempGroup_FrogVisibility and do (Actions)
        • Loop - Actions
          • Set TempPoint_FrogVisibility = (Position of (Picked unit))
          • Unit - Create 1 Visibility (for Triggers) for PLAYER_Silis at TempPoint_FrogVisibility facing Default building facing degrees
          • Unit - Add a CritterVisibilityDuration second Generic expiration timer to (Last created unit)
          • Custom script: DO STUFF
          • Custom script: call RemoveLocation (udg_TempPoint_FrogVisibility)
      • Custom script: call RemoveLocation (udg_TempPoint_Silis)
      • Custom script: call DestroyGroup (udg_TempGroup_FrogVisibility)
Thank you in advance. About 95% sure this is fine, but just wanted to check.
 
Status
Not open for further replies.
Top