• 🏆 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!

Simple group leak question....

Status
Not open for further replies.
Level 9
Joined
Oct 11, 2009
Messages
477
Does this way also clear the leak?


  • Trigger
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Playable map area) and do actions
        • MY ACTIONS
      • Custom script: set bj_wantDestroyGroup = true

Or this is the only proper way?

  • Trigger
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Playable map area) and do actions
        • MY ACTIONS
 
Level 10
Joined
Jun 26, 2005
Messages
236
I would do this instead:

  • someTrigger
    • Events
    • Conditions
    • Actions
      • Set someGroup = (Units in (Playable map area))
      • Unit Group - Pick every unit in someGroup and do (Actions)
        • Loop - Actions
      • Custom script: call DestroyGroup(udg_someGroup)
 
Level 10
Joined
Jun 26, 2005
Messages
236
In that case, the first trigger you posted won't work, and the second one will.

If you want to save performance avoid using GUI as it uses ForGroupBJ which is a stupid function. :)
 
There is not much of a difference between what BoneBreaker suggested and the second trigger you posted (because, like BoneBreaker said, the first one won't do anything). There are two things to consider:
• bj_wantDestroyGroup = true will destroy the first unit group created right after its use.
• The bj_wantDestroyGroup = true doesn't cause extra leak than the variable method (BoneBreaker's post), they clear the leak normally. I mostly use this method, so that I don't create unit group variables, but that's just me. ;]
 
Yeah, hah.

defskull, that's not how bj_wantDestroyGroup works, I thought you realised it, when I told you about it.

Whenever you create a unit group (and you don't want a variable for that group), just add this line above the Unit group action: Custom script: set bj_wantDestroyGroup = true and it will clean the leak right after the Unit Group action.
You can use it for infinite amount of Unit Group picks, not just one.

What you should know is that this action:
  • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
internally picks a random generated unit group variable to count those units, defined in the Unit Group action (in this case, the units in Playable Map Area). When there is no leak removal (call DestroyGroup()), the leak will restrain that bit of memory used to create that random internally-generated group. So, the line "set bj_wantDestroyGroup = true" is actually a boolean which orders the next memory leak of a unit group to be destroyed.
 
Status
Not open for further replies.
Top