• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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